Why part of the script executes after the timer expires?

Why do I receive the whole text "Hello world!Hello is done!" after 5 seconds the timer, not the first "Hello world!" and then after 5 seconds "Hello is done!"?
let http = require(`http`);

let app = http.createServer((req, res) => {
Res. writeHead(200);

 Res. write(`Hello world!`);

 setTimeout(() => {
 Res. write(`Hello ' is done!`);

Res. end();
 }, 5000);
}).listen(8080);
June 26th 19 at 14:06
2 answers
June 26th 19 at 14:08
because http doesn't work.
June 26th 19 at 14:10
``
Res. setHeader('Content-Type', 'text/html; charset=UTF-8');
Res. setHeader('Transfer-Encoding', 'chunked');
Res. writeHeader(200);
``

Find more questions by tags Node.js