Now had Balaam been a prophet of the Truth he would faithfully have transmitted this declaration of Hashem to the envoys of Balak and the purpose of Hashem's intervention would have been achieved without the whole following episode. Balak, andMoav, instead of fearing the attacking and conquering might of this People, would have been induced to know the moral factor which was innate in it to which Hashem had promised His blessing and to befriend them to their own advantage. But
Balaam suppressed the second part, the really essential part of Hashem's warning. He just speaks in general terms מאן השם, which forthwith allows it to be understood tat he himself would be pleased to curse the people, only מאן השם לתתי להלוך עמכם, the Hashem Whose prophet I am does not finnd it befitting for me to go with *you*. After all, they were only, as remarked above, זקני מואב not שרי מואב, only plebeans, not really princes.
As a result of this,
Balak knew his man and did not let himself be put off from his by the first refusal
As a result of Balaam attempting to work around Hashem, Hashem says, that if it for your personal honor that they came for you, go ahead and try to go with them. However, do not forget that you were categorically forbidden to curse the Bnai Yisrael, even though you hid that from Moav.
We have already remarked on verses 16 & 17) that Balak's request had two points (a) that Balaam come at his invitation and (b) that he curses Israel. For the first part he was given permission, regarding the second part, whic constituded the real intended purpose of Balak, it had in verse 12, already at the first mission had been peremptorily denied to him.
As we see, Hashem is telling Balaam that if he insists on going, he will only be able to convey the blessing, the exact opposite of what Balak intends.
The question now arises, why was Hashem angry? The reason given by Rav Hisrsch is that while Balaam was given permission to go with the messengers (אתם) he actually went with the intention to somehow bring about their purpose.
no כי הלך that he went with Balak's messengers, ... But he did not just go with them, הולך הוא, he was "goer" with them, one striving to reach his own end. In spite of the definite warning he had received from Hashem, his mind was still obscured by the obsession that he would be able to achieve the purpose so desired by Balak and himself.
As a result, the מלאך is sent to point out the result of what he is attempting to do. It is actually a final attempt to show mercy to Balaam and get him do do teshuvah.