display text generated via custom get query string

I’m trying to display some text on my page, generating it via get query string, e.g. calling this url: mysite.com/page/?letter=exampletext

If I understand correctly in such cases it is needed to "add them to the public query variables available to WP_Query" (stated here https://developer.wordpress.org/reference/functions/get_query_var/), so I followed directions adding the following code to my page template:

<?php  function queries( $  qvars ) {     $  qvars[] = 'letter';     return $  qvars;     } add_filter( 'query_vars', 'queries' );  $  text = get_query_var( 'letter' ); echo "letter is: ".$  text; ?> 

unfortunately this is not working as expected, since it only diplays the exlicit part of the string ("letter is: ").

What am I missing? Thanks everyone