How can I edit the content in index.php? [duplicate]

If you are editing a theme or you are having a child theme, You can make your own custom template, give it a name Include header and footer in it using

<?php
 /**
  * Template Name: Home Page
  * 
  * Home page Layout
 */
 get_header(); ?>
 <!-- Do whateveer you want here -->
 get_footer(); ?>

When you create a page in backend you’ll get an option to select the template for the page i.e Home Page, assign the template you just created
Home Page Template

and set this page as home page from settings.