使用命令行将纯文本插入文件ubuntu

I have xx file into ubuntu machine and I trying to access this file through php script and insert plain text into it . to insert text into this file I used bash file which contain this code

 echo $1>> xx

this script will get text which wanted to be insert as parameter and insert it into xx file

to run bash file I used this code in php

      header('Content-type: text/plain') ;

           echo  $txt = 'hello 
 how are you 
 ';

 shell_exec ("sudo /bin/bash  /etc/freeradiusbash/append.sh  '".$txt."'"); 

I want to print hello in first line and how are you in second line but the content of xx file is

hello 
 how are you 

how can I tell bash file to print text as plain text

echo -e "Top line 
Bottom line"
Output:  Top line
         Bottom line

Without the -e flag, the will be preserved as text.

First, change echo $1>> xx to echo "$1">> xx, then change

echo  $txt = 'hello 
 how are you 
 ';

to

echo  $txt = "hello 
how are you
";