The code I provided can easily be modified to do what you want. You are welcome to try to get your code to work if you'd prefer, but I'm not going to waste my time debugging your code, especially since it doesn't even come close to conforming to the POP3 protocol, not to mention that it would have to be completely rewritten to get it to work anyway.
To use my code (the first code) to retrieve and load an email into a dialog, simply run the code as described above, and after this line:
.rename mailget.tmp $+(%getmail.ticks,.txt)
add this line
.timer -mo 1 10 parsemail $+(%getmail.ticks,.txt)
And then make an alias called /parsemail that reads through the given text file ($1) and loads it into the dialog however you want. You can use your existing code (with minor modifications) to recognize From:, Date:, Subject:, etc and load them into certain dialog items, and then load the body into another item.
Anyway, it's up to you.