fix bash script; append vs overwrite