Mecanism of the reaction between amine and acid chloride

In the presence of strong base:

Alternative to the last step in the presence of an excess of amine: