Pattern: Whitespace after the here-doc end token
Issue: -
The end token of your here-document has trailing whitespace. This is invisible to the naked eye, but shells do not accept it.
Remove the trailing whitespace.
Example of incorrect code:
"▭" below indicates an otherwise invisible space:
cat << "eof"
Hello
eof▭
Example of correct code:
cat << "eof"
Hello
eof