Well first of all you are not losing a methyl group. You are losing a cyano group which was strategically installed so that is could be removed in a controlled and well known fashion. The cyano group -CN is a carboxylic acid synthon meaning that its chemistry is similar to that of a carboxylic acid. The last reaction involves nucleophilic attack of the cyano group by the glycol under basic heated conditions. You are right, if it were loss of a methyl it would be very confusing.