During your entire trip from the mainland to Macau, then to Hong Kong, then to Macau, and finally from Macau back to the mainland, you only need to apply for a Hong Kong and Macau endorsement once. Because you are traveling between Macau and Hong Kong, you only need to apply for an endorsement when you first enter Hong Kong and Macau. You do not need to apply for an endorsement again when traveling between the two places.