OCR A2 Chemistry impurity question helpWatch
In 4.1.4 you should have learnt about nucleophilic substitution of a halogenoalkane by ammonia (although most teachers do it in 2.2.2). Essentially, the lone pair on the N in NH3 attacks the d+ C next to the Cl. The 2-aminocarboxylate you have drawn STILL has a lone pair on it, so can attack a second 2-chloropropanoic acid by nucleophilic substitution, creating a secondary amine.
Ditto with the primary amine containing come secondary amine.