check if file exists and append to file