Displaying an array returned from a hook
Template hooks are useful if you need to change the current twig context array somewhere inside of a template. If you make any changes to $context inside of your hook's function, those changes will be available after your hook tag. 

If you just need to return some text or an array, a variable will do the trick just fine!