Can i take a sim card of an iphone and put in another iphone and put it back?

IMPORTANT there not the same one and if you did not understand lets say i take a sim card of an iphone 5 and put it in a iphone 4 and put back in the iphone 5
(i need to unlock the phone)

Yes, you have to buy a sim tray to do this job or you have to contact sim provider as iPhone 5 needs mini micro and iPhone 4 need micro sim

Different iPhones use different size SIM Card. So the Apple iPhone 4 uses a Micro-SIM card. While iPhone 5 uses a Nano SIM card.

If both the phones ( the ones with which you plan to play with) involved are similar, than you can do this otherwise you will have to buy a 3rd party SIM Adapter.

It should work in theory if the phone is unlocked. But an iPhone 4 uses a different size of SIM card.