new line when writing to a file (python)

i recently started to experimenting with python. after scripting my mathematics homework, i’m now able to write data to a file. the problem is that every time i do this, the data i put in the last time, is deleted, and only the new data is there.

is there some kind of way to start a new line after you wrote something to a file, and then write something else on a new line.

update:
after pasting ’
'behind the string, it makes a newline, but the
is also visible. is there a way to make a newline and a text without
at the end of all lines?

text in my file at the moment:

('hello there', '
')
hi')