How do i add custom fields to my themes template file?

Assuming you are looking for a solution to conditionally display your custom fields on public facing pages (non-edit page), you can use WordPress Conditional Tags.

if ( is_page_template('template-name.php') ) { 
    // Execute Your Code
}