Wamp Server error on running wordpress theme on localhost. How do I fix this error? [closed]

It be better if you have paste the code and not images but here you go:

Correct in index.php

<?php 
get_header();

if ( have_posts() ) : ?>
            <?php
                while ( have_posts() ) : the_post(); ?>
                <h2>....

Adding some context to above, the error telling that it found a character that doesn’t belong in that position. line 7 < h2.
This is why You add the closing php tag above. the_post(); ?>