no need to make a temp file when adding a line - just work on the file directly (a backup is made before anyway).
this function could have failed if there was a temp folder in the same path for example