When you use the twig_print_outside_roots option, the XML outside of the roots is output as soon as it is parsed. So you need to output the changed tags as soon as they are parsed too, ie in the handler, not after the end of the parse.
So you code should look like this:
open (my $fh_out, '>', $out_file) or die "unable to open '$out_file' f
+or writing: $!";
my $t = XML::Twig->new(
twig_roots => {'display-name' => sub { convert( @_,
+$fh_out) } },
twig_print_outside_roots => $fh_out, # as mentioned in a previous
+response
pretty_print => 'nice'
);
# including data for ease of post
$t->parsefile( $file);
sub convert {
my ($t, $elt, $fh) = @_;
... # do what you have to do to $elt
$elt->print( $fh); # this is where you have to print it
}