Use WP pagination functions on a custom page template

You can’t.

wordpress pagination API is designed to work with the main query and not with a secondary one as in your case.

There are many answers to similar questions around here with a all kinds of hacks to go around it, and while applying enough hacks, might make it work for your specific case, the basic answer should be that if you need pagination on a secondary loop, you have to write it yourself.

What you should do is to create a main query for the URL in which you want the page to be. Set your own rewrite rule to parse the specific url into whatever wp_query arguments you need for the loop, and use the template_redirect hook to use your specific template for that URL.

You can still use a page as a sort of “configuration scree” for the title and whatever other attributes you will need for that template to generate the proper HTML.

While in this solution you need to set the details correctly in several ways, it is IMO a much more reliable solution than trying to hack the pagination APIs.