I want to show recent post according to category of the post in single.php?

Have you tried researching about wp_query?

Also here’s a basic looping according to category :

$args = array(
    'post_type' => array('post'),
    'order' => 'DESC',
    'category_name' => 'test',
);

// The Query
$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
        $query->the_post();
            // Your custom code
    }
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();