To me it seems that you try to learn from what you are doing. That is why I will point you now to the fact that in:
if -f $ERRMSG ]
then rm $ERRMSG
fi
echo "Started $(date)" > $ERRMSG
the first three lines are useless. The > redirection will create the file when it does not exist (you are aware of that), and if the file exists, it will empty it before adding the redirected output. (The >> redirection will only add at the end). Thus the > redirection does allready exectly what you want here.