Hello Cher,
-Yes, both sentences can be use to refer that you are going home.
Je dois rentrer & Je vais rentrer:
Most of the time, those sentences imply that the person who is talking is going to his/her house, because they are use a lot in this kind of context, but it is not limited to.
You can actually use those sentences when you just go inside a building, shop or any interiors
Example: je dois rentrer (chez moi) or je dois rentrer (dans la boutique)
-If you want to say “I want to go back” in any context, they are several way of saying it.
Examples:
- Je veux repartir dans ce cinémas : I want to go back in this cinema
- Je veux revenir à Paris : I want to go back to Paris
- Je veux retourner à la bijouterie : I want to go back in the jewellery store.
Meaning
-Repartir is coming from the verbe “partir: to go/to leave” and “re” refers to repeat something.
repartir = go again
-Retourner is coming from the verbe “tourner: to turn”
With “re” repartir = turn again. Here it is more an expression of going back somewhere
-Revenir is coming from the verbe “venir: to come”
Revenir = come again
Hope it will help you to understand.