If a user is not logged in, your code will redirect to the login page even if the user is already in the login page so you end up with a infinite redirection loop.
You should check if the user is logged in and the page where he/she is and redirect if he/she is not logged in and if he/she is not in the login page. Add this code to functions.php:
<?php
add_action( 'template_redirect', 'wpse_redirect_to_login_page' );
function wpse_redirect_to_login_page() {
//You can use also is_page() function to check for specific page instead for a page template
if( !is_page_template("login-template.php") && ! is_user_logged_in() ) {
wp_redirect( get_permalink( ID_of_login_page ); );
exit();
}
}
?>
Also, you should take the login/auth process out of the template file. Ore, better just use the wp_login_form
in your template file. See How to Make a Custom Login Page.