1st step: SOCl2 or PCl3 to form an acyl chloride, which is now significanlty more electrophilic based on leaving gorup abiliity, hence an amine can now attack the acyl chloride to form the amide, where as adding an amine and a carboxylic acid would have just completed proton transfer.
2nd step: RNH2. Mechanism to be drawn on board, attack the carbonyl, remove proton, kick out chloride.
Problems with final step is that the conversion will create HCl in situ, which will acidifiy the base and make it an inert nucleophile, so add excess of amine to remove the HCl