hook_page_alter in Drupal 8
hook_page_alter in Drupal 8:

According to the change record Added hook_page_attachments(_alter)() and removed hook_page_build/alter() you should use hook_page_bottom:

function hook_page_bottom(array &amp;$page_bottom) {
  $page_bottom['mymodule'] = ['#markup' =&gt; 'This is the bottom.'];
}


You have another issue, theme() is no longer available. But this is another question as it is unclear what you are trying to do with it. Probably you should use the template in a render array $page_bottom['mymodule'] = ['#theme' =&gt; 'TEST'];.

In D8 all page elements are in blocks now. The best approach would be to provide the extra content in a custom block and place it in the block layout in the bottom of the page. See comment from @Kevin.