For the production of compound (IV) from compound (XVII), a chlorinating agent such as thionyl chloride or an organic sulfonic or organic phosphoric acid chloride such as methanesulfonyl chloride, p-toluenesulfonyl chloride or diphenylphosphoryl chloride is used.