Append text to files without duplication