Quote the heredoc delimiter unless you want expansion
A heredoc with <<EOF expands $variables and backticks inside it. <<'EOF' passes the text through untouched, which is what you want for a script, a config, or anything with a dollar sign in it.
cat > deploy.sh <<'EOF'
echo "$HOME is not expanded here"
EOFMost heredoc bugs are the quotes on that one word.
shell