Furthermore, it should be sufficient to append to the file without doing global search-and-replace.