while loop to be continue in next section

What you are looking for is PHP’s modulo operator and adjust markup as necessary:

<?php
    $i = 0;
    $did_hr = false;
    $post_args = array( 'post_type' => 'Student Form', 'posts_per_page' => 6 );
    $post_query = new WP_Query( $post_args ); 


if ( $post_query->have_posts() ) : 

while ( $post_query->have_posts() ) : $post_query->the_post(); ?>
    <?php if ( $i % 3 == 0 ) : ?>
    <section class="main_section" id="masc">
        <div class="container cardbox_1">
            <div class="row cardbox_horizontal d-flex justify-content-center">
    <?php endif; ?>
                <!-- while loop -->
                <div class=" col-md-4 cards">
                    <div class="card card_1">
                        <h3 class="h3 card_head text-uppercase">
                        <?php the_title(); ?>
                        </h3>
                        <div class="center_image d-flex justify-content-center">
                            <a  rel="external" href="https://wordpress.stackexchange.com/questions/356985/<?php the_permalink()?>">
                                <img class="image_head" src="<?php echo get_the_post_thumbnail_url(); ?>" alt="">
                            </a>
                        </div>
                        <div class="para_head">
                            <?php the_content(); ?>
                        </div>
                        <div class=" d-flex justify-content-end">
                            <a href="#" class="btn btn-primary">VIEW MORE</a>
                        </div>
                    </div>
                </div>
    <?php $i++; if ( $i != 0 && $i % 3 == 0 ) : ?> 
            </div>
        </div>
    </section>
    <?php if ( ! $did_hr ) : $did_hr = true; ?>
    <!-- middle section-(should not loop -this considered a border to top and bottom sections)ending -->
    <section id="babg">
        <div class="container">
            <div class="row ">
                <div class="col-md-12">
                    <hr class="this bbg">
                </div>
            </div>
        </div>
    </section>
    <?php endif; ?>
           <!-- middle section ending -->
    <?php endif; ?><!-- while loop-->

<?php endwhile; // ending while loop ?> 
<?php else:  ?>
    <p><?php _e( 'Sorry, no Students matched your criteria.' ); ?></p>
<?php endif; // ending condition ?>