uma solução alternativa para evitar o escape "and", mantenha sua saída legível ao visualizar o script:
cat >output <<textmarker
-construir
Exemplo:
#!/bin/bash
cat >filename.txt <<EOT
Your output-text starts here
Every new line or tab will be on the output too
"text0" 'text1' echo "Hello"
#Any other even huge text //
\n But Dollarsign and backslash have to be escaped
For example \$ and \
your output-text ends with this marker, which had to be on a newline without whitespace
EOT