plugin wraps the entire content


I have made a small plugin which grabs the post from another blog of mine, and I render it using a shortcode:

<div class="blog__grid">         <?php             // If there are posts.             if ( ! empty( $  posts ) ) {                  // For each post.                 foreach ( $  posts as $  post ) {                      $  featured_img = $  post->_embedded->{'wp:featuredmedia'}[0]->source_url;                     $  ecerpt = $  post->excerpt->rendered;                     // Format the date.                     $  fordate = date( 'n/j/Y', strtotime( $  post->modified ) );                       // Show a linked title and post date.                     ?>                     <?php                     $  allposts .= "<div class='blog__grid__post'>                     <div class='blog__grid__post__image'>                         <img class='blog__grid__post__image--img' src='{$  featured_img}' />                         <a class='blog__grid__link' href='/blog/" .$  post->slug. "'>"                         . esc_html( $  post->title->rendered ) .                         '</a>                     </div>                         <div class="blog__grid__post__meta">'                         . esc_html( $  fordate ) .                         '</div>                         <div class="blog__grid__post__excerpt">'                             .$  ecerpt.                         "</div>                     </div>";                  }              return $  allposts;         } ?>     </div> 

Now when I try to add more content to the page which uses this shortcode, everything I write is encapsulated inside the blog__grid tag, here is a screenshot from the inspector, the highlighted elements should not be inside this div, and I don’t know why they are, can someone please help me with that?

enter image description here