P-cyanobenzyl chloride (1 g, 6.6 mmol) was dissolved in a mixed solvent of ethanol and water (10 mL, ethanol:water in mixed solvent = 2:1), methyl piperazine (1.2eq, 0.792 g, 7.92 mmol) was added, and the reaction was heated at 70 C for 1-2 h. After the reaction was completed, the reaction was cooled down to room temperature and most of the ethanol was recovered to give 4-(4-methyl-1- Piperazinyl)benzonitrile, add sodium hydroxide (6eq, 1.584g, 39.6mmol), heat the reaction at 70 , wait for the reaction is complete, cool to room temperature, slowly add dilute hydrochloric acid dropwise under an ice bath to pH=1, add sodium chloride to saturation, cool to precipitate a solid, filter, and dry, that is, to obtain 4-(4-methylpiperazin-1-ylmethyl)benzoic acid hydrochloride (2.0g).