Synthesis of polyamides through active diesters