In your first code, the word "start" was printed on the page as the document was loaded, and it happens one time only.
And then setInterval() is invoked to schedule a call to pr() function once every 3 seconds. The "hello world" text are printed after the document loading phase completed, and that's why the "start" text was deleted.
In your second code, both text are printed during the document loading phase, and that's why "start" text is not erased.
Whatever was there after page load phase completed will be erased by a call to document.write()