Can anyone explain why \n is not working as line break?
[user1@localhost ~]$ echo -e a\nb\nc
anbnc
On
A backslash is interpreted by bash to escape the subsequent character. For instance, foo \* passes an asterisk to foo instead of doing globbing. Similarily, foo \x passes a literal x to foo; escaping is unnecessary, but not forbidden. In your case, the shell turns a\nb\nc into anbnc.
If you want to pass a literal backslash, you have to use \\ , for instance
echo -e a\\nb\\nc
Or you use use single quotes, which escape the whole content in one go:
echo -e 'a\nb\nc'
Or you don't rely on echo doing the newlines, but insert them explicitly:
echo $'a\nb\nc'
Or with a HERE document, in which case you have to use cat instead of echo:
cat <<EE
a
b
c
EE
Use more quotes!
or even better:
Learn how to quote properly in shell, it's very important: