Having issue with WordPress loop

As per the documentation I am doing everything right, but on the
frontend, it is not showing all of the posts, Any idea what I am doing
wrong?

The documentation does not say to use a custom page template for displaying the blog archive. As shown in the template hierarchy the template for your blog posts archive should be home.php, or index.php. Then in that template you add the loop as described at your link:

<?php 
if ( have_posts() ) : 
    while ( have_posts() ) : the_post(); 
        the_title( '<h2>', '</h2>' ); 
        the_post_thumbnail(); 
        the_excerpt();
    endwhile; 
else: 
    _e( 'Sorry, no posts matched your criteria.', 'textdomain' ); 
endif; 
?>

This template should not have the Template Name: header, or be assigned to a page. Instead it will be applied automatically to whichever page you have selected as the latest posts page in Settings > Reading.

Note that all templates in the template hierarchy use the same basic loop:

while ( have_posts() ) : the_post(); 

endwhile; 

You do not query any posts from the template. WordPress automatically queries the correct posts, and the template’s only job is to display whichever posts have been queried. Which template is used, and why, is determined by the template hierarchy, linked above.