how to write multiple lines to a file using shell script?

I need to create an xml using shell script, but i first want to know how can i write multiple lines to file using shell script?

cat <<EOF >filetoreplace
a
b
c
d
e
f
g
EOF

You can also append with >>filetoappend.

Also remember you can redirect the output of entire shell loops, not just individual statemenets.

hi corona,
Thanks for your reply..but i cant open the file i have created after using the script u have provided..it just error out. i new to shell scripting please help.

It's much easier to help if you specify exactly what the errors are, otherwise we're just guessing.

i am saving the document in a remote directory, the file which i have created using the above script is not saved as a text document. when i checked its property its format just says TXT,so i cant able to open it up. Hope this clears.

Open it up with what?

What do you see if you cat the file?

Of course it's an ASCII text document; what else could it be? Some remote hosts are more picky about file extensions than UNIX though. Be sure to give it the extension you want.

When i cat the file, its blank document. I will try once again and share the results.