If you buy a regular point-to-point ticket, you can get off at any intermediate stop and get back on again. The ticket is valid on any train on that day and it is explicitly allowed to get off and continue the journey on a later train. Note that you may not take a different route than what is indicated on your ticket (In your case, that would probably be passing via Bern, Spiez, Visp) but you may chose to take slower trains, if they run on the same line. Your ticket is not valid to do an additional detour to also walk around Lucerne, for example.
Note that this does not work with Supersaver’s tickets.