Getting each hex value can be done by converting 2 characters to a number (strings command).
Of course you need to be sure that the number of characters is even. Else, you have to test for that first.
However, if you need your result (as you post it) as a string, it might be easier just to insert the spaces.