$$\ce{R-COOH ->[SOCl2,CH2N2][Ag2O/CH3OH] X}$$
While solving Carboxylic derivatives recently, I came across this. so following the reagents one by one-
$\ce{SOCl2}$ will form acid chloride.
$\ce{CH2N2}$ (diazomethane) on the other hand reacts with carboxylic acid to give a methyl ester. but we are currently on acid chloride, this part is a little confusing to me.
$\ce{Ag2O}$ in aqueous/alcoholic medium should give ($\ce{CH3O-}$) ions.
How to proceed? What is wrong with my reaction mechanism?