Programatically create a page

You can try

// add a new page
$args = array (
    'post_type'   => 'page', 
    'post_title'  => 'My New Page',
    'post_status' => 'publish',
); 
$pid = wp_insert_post( $args );

// add a custom template file to the newly created page
if( $pid > 0 )
    add_post_meta( $pid, '_wp_page_template', 'custom-template.php' );

where we set the page template file via the _wp_page_template meta key.