is it safe to use MacBook pro charger to charge my ThinkPad t470 laptop
The T470 can be charged via USB-C (Lenovo even sells such chargers as accessories for the T470) , so if your MacBook Pro charger is a USB-C charger it should work.
Charging may be faster or slower than via the regular T470 power-adapter. That will depend on how the Apple charger and the T470 work together and without having tried that myself I can't predict how that will turn out.
UPDATE: I'm now in the office and can check the T470's we have around here. Charging via USB-C should work with any generic adapter that can deliver a minimum of 45W via 20V on USB-C. 5V only USB-C adapters won't work.