Unable to create pagination for Category.php

Check up the wordpress templating hierarchy The graphics reads from left to right.
You have custom post type products so you can override this file and your code should be in category-products.php, since you are limiting your WP queury for products posts. Category.php is similar but without this limitation.

   // Your category-products.php loop should be like this
   <!-- Prepare query -->
   $your_query = new WP_Query( array(
     'post_type' => 'products',
     'posts_per_page' => 20,
   ));

   if ( $your_query ->have_posts() ) :

   while ( $your_query ->have_posts() ) : $your_query ->the_post();?>
   <!-- Show a card -->
   <a href="https://wordpress.stackexchange.com/questions/349859/<?php the_permalink();?>">
   <div class="product">
   <div class="image-container">
   <?php the_post_thumbnail();?>
   </div> 
   <p class="title"><?php the_title(); ?></p>
   </div>    
   </a>   

   <!-- loop-end -->
   <?php endwhile;  ?>

   <!-- pagination -->
   <div class="col-md-8 post_paginations" style="text-align:center;">
   <?php the_posts_pagination( array(
   'mid_size'  => 2,
   'screen_reader_text' => __( ' ', 'theme_name' ),
   'prev_text' => __( 'Previous', 'theme_name' ),
   'next_text' => __( 'Next', 'theme_name' ),
   ) ); ?>
   </div>

   <!-- Else -->
   <?php else : ?>
   <h1><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></h1>
   <?php endif; ?>