i writing a unix script but i want to out put a file and append on it.

i have an existing script that is used to send an e-mail containing the alrams that appear on the server.
But i need to create a daily log file containing all the alarms that was send that day.

i tired to add at the and of the script a command, echo command but for some reason the file was never created can any one help plz :wall:

echo $x >> alarms_export_date.txt

echo $x >> alarms_export_`date +%Y-%m-%d`.txt

were x is the variable that contains the alarm.

Show more of the script. It's possible it exits before then.