Thermal energy is transferred to material,the motion of its particles speeds up and it's temperature differences.Insulating materials are bad conductors and so this reduces the heat loss by conduction.The material also prevents air circulating inside the cavity,therefore reducing heat loss by convection.Heat loss through the roof can be reduced by laying loft insulation.