Remove the last character from tag name in tag archive page

Two things here, one is wrong syntax because you’re opening and closing PHP tags twice. The second problem is the wrong usage of single_tag_title().

If you want this function to return value instead of outputting it (and you need that because you want to manipulate the string), you need to set the second parameter to false. (see the second example: https://codex.wordpress.org/Function_Reference/single_tag_title )

Also it’s a good idea to check if you didn’t get an empty result.

So your code should look like this:

<?php
$tag_title = single_tag_title( '', false );

if ( ! empty( $tag_title ) ) {
    echo substr( $tag_title, 0, -1 );
}
?>