"rpm -U did not save the modified file (Y)
it just deployed the new file (Z)
what am i doing wrong?
You aren't doing anything wrong. The person who set up the rpm probably should not be deploying the file you call Z. In any case the solution to the mess is for your distributor to create smarter update rpms.
The file Y was originally set up by either your distribution's installer or by your distribution's control program such as YaST2 in SuSE. You can fix up the file by looking at Y and Z and deciding what to do. Perhaps you want to use Y or perhaps you want to merge the information in Y and Z.
Or you can use Z and run your distributions control program to make the necessary changes to Z.
Personally when I run into this situation I almost always just use Y and delete Z but it varies on a case by case basis.
Be prepared. Create a LifeBoat CD.