It will let you write the text on terminal which will be saved in a file named file.
will do the same, except it will append the text to the end of the file.
N.B: Ctrl+D to end writing text on terminal (Linux)
A here document can be used to inline the contents of a file into a command line or a script:
cat <<END >file Hello, World. END
The token after the
<< redirection symbol is an arbitrary string which needs to occur alone on a line (with no leading or trailing whitespace) to indicate the end of the here document. You can add quoting to prevent the shell from performing command substitution and variable interpolation:
cat <<'fnord' Nothing in `here` will be $changed fnord
(Without the quotes,
here would be executed as a command, and
$changed would be substituted with the value of the variable
changed -- or nothing, if it was undefined.)