Whether or not bots see the text has more to do with when it is loaded and not so much how.
Before I explain this in more detail, you should be aware that Googlebot now renders JS content, it typically doesn't occur at the same time as the initial crawl but can occur at a later point when it feeds the previously crawled page to the JS rendering engine. There is no guarantee that Google will ever render your page, so I would be very reluctant to depend on it for index purposes (not what you want anyways) but by the same logic you cannot be sure they won't render the page. If you absolutely do not want Google to see the content then I'm not sure hiding it with delayed JS will work anymore. YMMV.
One should avoid using document.write, it is to be used before the page has loaded. Including it in a script tag will likely cause the page to re-render everything that was on the page up to that point. It will restart loading the page and then in the second go-around include the text. Since your page hadn't fully loaded, Googlebot will be waiting around for page to complete and will then pickup the text that was add. So it will slow the page down considerably and doesn't help you achieve your goal.
What you need to is wait for the page fully load and then insert the text. You could even wait for a user interaction, as there would be no point in loading resources that no one will read.
The easiest way would be something like this:
window.addEventListener('load', function () {
const footer = document.querySelector('footer');
let newText = document.createElement('p');
newText.textContent = "Loreat Ipsum";
footer.appendChild(newText);
})
The above example uses the 'load' event, which means the script will be triggered after the page is fully loaded. To use user interaction as the event, you could use a 'scroll' event, but this will be triggered each time the user scrolls so you'll need to add code to prevent the script from running more that once.