General method D for the synthesis of compounds 23, 24 and 25