I'm not religious, so from my point of view (which is a communication scientific one) the reports about events religions pass on are not true or false but they have certain narrative aspects which are certainly worth analyzing.
Moshe having to or being able to view the land of his dreams while having the knowledge of never being able to enter it triggers strong emotional responses in the people perceiving this narrative. They are likely to relate to this situation of hopeless longing.
This makes it way more probable to get passed on while the narrative develops during a tradition phase. Similar narratives which lack this aspect are less likely to get passed on, so this one "survives". (I'm I'm aware that religious people might believe that this text was conceived and never "developed", but I do not believe this. If (If somebody feels offended by this, please forgive me, this is not my intention.) And concerningeven if we assume in judaism.stackexchange.com that the Torah was written directly by God and never changed, we should try to understand how He made it to be compelling to the people who read it. Then the same psychological mechanisms can apply which in other circumstances make a text survive an evolutionary process.
Concerning the aspect whether Moshe was forced to look at the land or whether he wanted to: This is of minor importance (viewed from this angle). Both options trigger an emotional response. In the one case the response was about the hard to understand cruelty of making someone long for something even more. In the other case about the benevolence of Hashem for having the generosity and grace to at least showing Moshe what he longs for. So consequently the narrative often is told without clarifying this aspect (hence leading to this question).
So from this point of view, the answer is: The narrative about Moshe contains this scene (or these scenes) to raise emotional responses. Narratives showing such features have a greater chance of being passed on through the generations. This also makes the whole narration more likely to provide an emotional help for people in longing situations.