A classic use of here documents is to create a file by typing its content:

cat > fruits.txt << EOF
apple
orange
lemon
EOF

The here-document is the lines between the << EOF and EOF.

This here document becomes the input of the cat command. The cat command simply outputs its input, and using the output redirection operator \\> we redirect to a file fruits.txt.

As a result, the fruits.txt file will contain the lines:

apple
orange
lemon

The usual rules of output redirection apply: if fruits.txt did not exist before, it will be created. If it existed before, it will be truncated.