Line breaks in string

What I want is for the line breaks to happen when saving the string, not to stay inside the string as “\n”.

I am new to JS so I have no idea how JS handles strings. I have just tried .replace() but my ending string still has the line breaks.