Use of render array in theme layer
Drupals render arrays are a great invention which make it possible to alter the output of content by others (modules, themes etc.).

If you would hard-code your output in variables to print, no one other can alter it. But if you use render arrays, then other modules can implement hooks to alter the rendering of your output if they need to do so.

For this flexibility it is best practice to use render arrays until the very last moment and let the twig template build the html from it.