Help with if statement inside while loop

You’re setting $id = $post->ID; outside of the loop for agent_type posts, it’ll never match.

Anyway, if you’re not doing anything with the agent_type posts that don’t match, just query for the one post you want by its ID:

$list_agent = get_post_meta( $post->ID,'ec_agents',true );
$args = array(
    'post_type' => 'agent_type',
    'p' => $list_agent
);
$agent_query = new WP_Query( $args );
while ( $agent_query->have_posts() ) : $agent_query->the_post();
    echo get_post_meta( get_the_ID(),'_agent_phone',true );
    echo get_post_meta( get_the_ID(),'_agent_email',true );
endwhile;
wp_reset_query();