How can I add a title to this ‘maintenance mode’ function?

You can pass a title to the wp_die() function or even any other HTML content like heading tags:
https://codex.wordpress.org/Function_Reference/wp_die

But if you are trying to have more control over what’s being outputted, you should use the template_include filter and use your custom template:
https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include

EXAMPLE:

add_filter( 'template_include', 'show_maintenance_page', 99 );

function show_maintenance_page( $template ) {
    if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ){
        $new_template = locate_template( array( 'maintenance-template.php' ) );
        if ( !empty( $new_template ) ) {
            return $new_template;
        }
    }
    return $template;

}

Create a file called maintenance-template.php on the root theme folder for this example:

<?php
/*
Template Name: Maintenance mode
*/ 
?>
<img src="https://wordpress.stackexchange.com/questions/304668/<?php echo get_stylesheet_directory_uri(); ?>/graphics/header/logo/1.png" />
<p>
    <strong>Site temporarily offline for maintenance.</strong> 
</p>