The letter that Hamlet sends to Horatio includes a summary of what happened while he was on the ship. Without that letter the audience would not know how he made it to the ship that was bringing him home. It also shows that Hamlet still trusts Horatio more than anyone else. Even though Rosencrantz and Guildenstern were his college best friends, they were there to spy on him so Hamlet would have a reason to distrust everyone. Writing the letter to Horatio shows that he is the only person Hamlet is willing to tell his secrets and plans to.