WordPress – Display page content and not custom post type with

I have created a custom post-type with a single page that serves as a template page, the CPT are listed as expected but when I include the to list display the page content, it displays for a post content instead

    <? while ( have_posts() ) : the_post();?>

      $args = array(
            'posts_per_page' => -1,
            'post_type' => 'rooms',
        );

        $the_query = new WP_Query($args);
        $categories_posts = array();

        if ($the_query->have_posts()) :
            while ($the_query->have_posts()) : $the_query->the_post();
          //code
          <? endwhile; endif; ?>

           <?php the_content();?>

I tried to move the <?php the_content();?> above the query and it displays the content i need but it doesn’t work below the query