Send a variable with a URL and get a variable with Wp query

Make sure that the page template is applied to the correct page and you are accessing the correct URL

and then go to the Settings > Permalink and save permalinks one or two times.

That should clear the older rewrite rules and make the new page template work instead of sending you to the 404 page