Egestion is the expulsion of undigested food which occurs typically via the anus. Although, interestingly or maybe just gross, flatworms must use their mouth has they have no anus. This is the non-metabolised material.
Excretion is the transfer of any metabolised material to the environment, including urine or carbon dioxide.