bash output inside the terminal : command not found
Well, $HOSTNAME is a variable, and if you just write it on a single line and press enter, bash will simply replace it with the respective value, i.e. "TEST.local". Since "TEST.local" is not a valid command, bash will complain. 

If you want to print the value of any bash variable, you should use echo, i.e. echo $HOSTNAME. 

For a quick bash scripting tutorial regarding variables, see here for example.