The script (and novels) all seem to broadly concur that Rey was simply running away after having suffered a terrible shock. When she finally stopped and thought about it for a few seconds, she realised that she was just going to have to turn around and trudge back to the castle.
Before she could complete her thought about her next action (which presumably would have been asking Han to drop her off on Jakku) the First Order fleet turned up.
[EXT. FOREST - DAY: Rey races through the forest and finally comes to a stop, overwhelmed and exhausted. At an emotional breaking point, she has no idea where to go, who to turn to. Then she HEARS A BEEP -- turns to see BB-8, catching up with her.]
The Force Awakens - Official Screenplay
Overwhelmed and exhausted both physically and mentally, Rey finally
slowed to a halt. Running solved nothing. Besides, she had nowhere to
run to, and she could not run from herself. A familiar electronic
chirp made her turn.
The Force Awakens - Official Novelisation
REY finally stopped running, deep in the forest. She didn’t know why she had been running for so long; she had just felt the need. Now all she felt was exhaustion.
The astromech unit chirped a question of his own. He wanted to know where she intended they go. They? Just because the two of them had traveled together in the past, it didn’t mean they would do so in the future. Finn had reminded her of that.
But despite her pleas, the little droid refused to leave her. He would go wherever she went, to Jakku and back again if that’s what she wanted.
Star Wars: The Force Awakens: A Junior Novel
REY RAN THROUGH THE FOREST outside of Maz’s castle. It was too much.
She was tired of people she barely knew telling her how she should
feel. She just wanted to go home to her simple life on Jakku. It was
The Force Awakens: Rey's Story