Write text to file literally, including special characters

Viewed 3993

I want to write text to file in a bash script, literally and without modifying special characters. I search a function or command similarly to:

echo'line1
line2' > destination/file

but including all special characters inside text $ ' " (etc) and without modifying these characters.

2 Answers
Related