purpose of NaOH?
Ammonolysis is the reaction in which R-X is converted into R-NH2 and one of the byproduct is HX.Haloacids are very reactive and can reverse the reaction. So it is important to neutralize these acids so NaOH is added to remove acidic impurities.