In the PowerShell window you should give it in a singe line like,
$temp="error"; Try{ Get-TransportRule -Identity TA|fl } Catch{ $temp }
The other way of doing this is, save it in a file with .ps1 extension and if you try to run that from powershell it will handle the exception.

If you use multiple lines, the command will be executed in the order and each line will be considered as a separate command. So in your image, it is executing line by line and when it comes to Get-TransportRule command it doesn't have any connection between try and catch because it's a separate command.
Hope it helps! Cheers