Add to file if exists and create if not
Use two angles: echo $some_line >> /path/to/file
> creates the file if it doesn't exist; if it exists, overwrites it.
>> creates the file if it doesn't exist; if it exists, appends to it.
if [ ! -e /path/to/file ]; then
echo $some_line > /path/to/file
else
echo $some_line >> /path/to/file
fi