Move back and forth dynamically

The object should move back and forth dynamically with the help of LineTrace. First to the right, then to the left, etc. The object should not rotate. How can I best implement this:

Thanks in advance!

Something like this:

then back trace is basically the same

342867-bounce.gif

To stop it going to the origin when it’s uncertain of where to move, you can change the timeline part to

Jes, thank you for your active support!