You can use a global variable.
In this example I have a function which sets the global var to the last scene name
window.lastScene = hypeDocument.currentSceneName();
The function is then set to run on each scenes "On Scene Unload"
I then have a buttons on each scene leading the a scene and a back button.
The back button runs a function to go to the scene with the name that the global var's value matches.
LastScene.hype.zip (60.6 KB)
This should give you an idea of how to reach you goal using the global variable.