How to append text to a file on a new line December 11, 2023 by Tarik You should put the \n first. That way your newline will be written before your text: f.append('\nhello again!')