To execute multiple commands like a function (with PgAdmin), you have to wrap the commands in a DO block:

 

DO 
$do$
DECLARE
  _my_text text = 'HELO';
  
BEGIN
       RAISE NOTICE '_my_text: %', (_my_text::text);        --in this specific case ::text is unnecessary because _my_text is already a text

       DECLARE t_record RECORD;
       BEGIN       
           FOR t_record IN 
                
            SELECT * FROM public.comp
                        
        LOOP
            RAISE INFO 'Row in myTable: %', t_record::text;
        END LOOP;       
        END;   
END
$do$;