Hi Francisco! Welcome to the Android Central Forums!
I have pretty good experience with this as T-Mobile is my primary carrier. If you have a T-Mobile activated nano-sim you should be able to pop it right in there. However, there could be a couple red flags:
1. If it has an outstanding balance, it can absolutely work on a different T-Mobile account (yours) as long as the device continues to be paid on/the account it was purchased on is in good standing. The minute that account defaults on the device payment after a certain amount of unpaid time that IMEI for the iPhone 7 will get blacklisted. Do you have have the IMEI by chance? If so, you can message me privately and I can send it through a checker to see if its whitelisted for now.
2. Usually, a device bought on payment plans are locked to that particular carrier (there are exceptions like I have a Pixel on a Verizon payment plan but a T-Mobile sim in it and it functions great). If you put a sim from another carrier in there it wouldn't hurt anything but you you would likely get a message stating that the sim is incompatible with the device.
Your biggest issue will be if the device has already been blacklisted with that remaining balance. If its still in good standing you should have no issues popping your personal T-Mobile sim in. Its not guaranteed to work forever though if the person defaults on their payment.
Hope this helps!