Hi there and welcome
Sprint uses CDMA, and only has a SIM card on some models for LTE data connections.
T-Mobile uses the GSM network, which is different to how Sprint operates and requires GSM phones. In effect. T-Mobile, AT&T and all other GSM providers can use each other once unlocked, and phones such as Sprint, can be unlocked to work on CDMA networks such as Verizon.
This is why the code is not working, you need to switch the phone to a CDMA network and for that they register you on it, so for example you would contact Verizon, indicate its out of contract and they would then take you through the process to register the phone on their network. You would then need the code that sprint gave you, for this. But this is why its not working as your trying to use the CDMA phone on a GSM network and that will not work. The GSM/UTMS your referring to is for data, which is the only time the CDMA phone use GSM services.
If you would like any additional information or assistance, please do not hesitate to let me know.
Else if you can take a second to rate my service by clicking one of the stars at the top of the screen then submit, that would be greatly appreciated.