Realistically, the guards were put there to halt the transfer of people, goods, and currency: to be the physical manifestation of a hard border. Although, the motivation for this border (who it benefits, is it to keep "others" out vs "us" in) was a dynamic concept that evolved over time.
However, if you integrate the motivation function over the entire time of separation, which is one way of reducing the complexity, the primary result is to keep easterners from escaping. In the early days of widening division, there was a mass migration of people fleeing "The East"; each person carried a multitude of reasons for their flight. One effect of the border was to halt this flow.
There were easterners who sincerely viewed this differently, and wanted to keep westerners out (especially the "spies"!); however, their perspectives were definitely a minority, and don't survive the integral.
If you're interested in the topic of the east/west German border's materialization over time, I'd recommend you to Edith Sheffer's excellent book on the subject [0]. It focuses on adjacent villages in Thuringia, and how they took turns coping with, helping create, and profiting from the existence of the border.
It's a great illustration of Simpson's paradox [1]: something that looks kind of simple on the surface (of course there would be a border between NATO and Warsaw Pact), becomes more complicated when you glance at the details (the people living on either side were mostly German citizens, with ideas and ambitions and fulfilling lives).
Then, you zoom in on the details (individual people, families, towns, neighborhoods), and again you're presented with something comprehensible. For example, a mayor can get special funding from the Marshall Plan, by emphasizing the propaganda opportunity of building attractions near the border; to get this money, it's helpful to sell the idea of a fundamental difference between east and west; once the attractions are built, there is now a real difference between east and west, whereas before it was imaginary. When you zoom out, it's these little independent assertions of autonomy and appeals to authority that motivate the creation of a border. Super fascinating stuff.
[0]: https://www.amazon.com/Burned-Bridge-East-Germans-Curtain/dp...
(As an aside, why do you feel the need to be so confrontational...?)