To actually have a pippo
file, you need to do:
cat > pippo <<EOF
Which redirects the values in the here-document to the file named pippo
.
Then, to have the contents inside the here-doc piped exactly as written and not expanded, evaluated or changed, you need to quote the word after the <<
.
Any of this (even partial quotes work):
<<'EOF'
<<"EOF"
<<\EOF
<<E"O"F
<<E\OF
If there is no quoting, the value of variable "$LOGFILE"
gets expanded to its value, which seem to be null in your environment, and gets lost.
In short, use something like this:
cat > pippo << \_EOF_
LOGFILE=test.log
echo '#############################' >> $LOGFILE
_EOF_