What happened to the apostle John after the Biblical account of his life ends? There is a legend that says that John traveled to Ephesus where he took care of Virgin Mary and that he lived there until the end of his life.

Is this legend true? Are there any historical accounts that support the legend? Are there any other theories about the later life of apostle John?
We know from scripture that he was exiled on the Isle of Patmos near the end of his life - reliable understandings of when his epistles and the book of Revelation were penned indicate it was around the year 90 AD.

Where he was between ~50AD and 90AD (with 50 being a plausible time for Paul's early writings, and the original disciples/apostles to still be in Jerusalem), I don't believe we're ever told.

Also, Jesus' mother Mary would have been fairly old by then - she should have been at least mid 40s when Jesus began to preach (if she was ~15 when he was born). By the time of the early church and Paul's appearance on the scene (after his time out of the record when he was apparently studying and learning), she would have been at least in her mid 60s, if not older.