Because the heredoc delimiter is quoted (`<<'EOF'`), it is unnecessary to escape the dollar-signs in the heredoc itself—in fact, that will cause the file to be created incorrectly because it will contain the escaped text.