Use file.append to write
Merge pull request #18150 from cachedout/debian_append

Use file.append to write