Replace custom logo with text

To display the text which you input from Appearance > Customize > Site Identity you can use this code:

<h1><a href="https://wordpress.stackexchange.com/questions/354477/<?php echo esc_url( home_url("https://wordpress.stackexchange.com/" ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>

Otherwise, tell us from where that text should be coming from.

You may also try the following:

Open functions.php of your theme and add this:

add_theme_support( 'custom-logo', array(
    'height'      => 100,
    'width'       => 400,
    'flex-height' => true,
    'flex-width'  => true,
    'header-text' => array( 'site-title', 'site-description' ),
) );

Then add the following code wherever you want your logo to appear:

<?php 
   $custom_logo_id = get_theme_mod( 'custom_logo' );
   $image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
      ?>
<img src="https://wordpress.stackexchange.com/questions/354477/<?php echo $image[0]; ?>" alt="">

Then add your logo text inside of Appearance > Customize > Site Identity as shown here:
enter image description here