\n --> newline character is not working for inserting a new line.
str="Hello!!";
document.write(str);
document.write("\n");
document.write(str);
But if we use below code then it works fine and it gives new line.
document.write(str);
document.write("<br>");
document.write(str);
Note:: I tried in Visual Studio Code.