Transmitting the same colour from a type family to an overlying mass

Hello everyone! I would like to pass the colour from a type family to a mass above. The script used so far has taken the material in general into account. Actually, since the colour to the ‘source’ type family is assigned as a surface motif, I imagine that the nodes to be used are material get properties and material set properties. In addition, I think a link should be established between the object below and the mass above. How? Sorry, but I am not very experienced in Revit



Update. I set up the script in this way, testing between a family type and a mass. It seems to work, but I don’t see an actual result. Moreover, the material is not the same