You enter inside the event loop only when an event is triggered, you wouldn't want your window to display things only when an event a triggered isn't it? :p
And when you continuously move something, you want it to move every frame, not only when an event is triggered.
Putting your code inside the event loop gives the impression that it's executed every frame but it's not. It's because when you hold a key, the KeyPressed event is rapidly repeated (unless you disable key repeat).