How to safely escape the title attribute

Some screen readers read the title attribute plus the link text – so those visitors would hear “Hello world! Hello world!” – so unless your real title attribute is different than the link text and provides additional context to users of screen readers, you may wish to just not use the title attribute.

Or, you should be able to rewrite everything so that instead of echoing you have something like

<?php // your other code here ?>
<h2 class="m-title">
    <a href="https://wordpress.stackexchange.com/questions/327755/<?php echo esc_url(get_permalink()); ?>" title="<?php the_title_attribute(); ?>">
        <?php the_title(); ?>
    </a>
</h2>

This way you’re mixing HTML and PHP but it allows you to immediately output both, so that the_title_attribute() is outputting in the right spot and not before everything else is parsed. You can add the additional esc_html__() call wrapped within each set of PHP tags but it’s not clear why those would be needed for fields like the_permalink().