add appendToFileIfNotFound function