To create a Page Template, the first thing you would need to do is add the Template part right under the first <?php
like this –
<?php
// Template Name: Portfolio
Then you can add any other code you need under that.
You can look at the other page templates in the theme to see what I’m referring to (page_portfolio, and page_landing.php)