John wrote because JESUS told him to write.
I KNEW that one was coming! :-)
Click the link if you want to learn a few more details...