Why my loop isn’t working? [closed]

I’m not 100% sure what you’re trying to do with this.

Out of the Box, WordPres allows you to set your home page as either a static page, or a blog. If you choose blog, it will automatically output title and content for you.

If you’re trying to customize a static home page, then you’ll need to add a piece with arguments, like they’ve been saying there in the comments.

    <?php   
    $args = [
            'post_type'      => 'posts', // you can also use custom post types here
            'posts_per_page' => '10', // how many I want to display
            'post_status'    => 'publish', // I only want published posts to appear

        ];

    // The Query.
    $the_query = new WP_Query( $args );

    // The Loop.
    if ( $the_query->have_posts() ) {

    while ( $the_query->have_posts() ) {
            $the_query->the_post(); 
    } ?>

    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <hr>

    <?php endif;
        wp_reset_postdata();
    }
    ?>