I misunderstood your initial request; what I provided was a way to move to an object in line of sight. What you need is AI query abilities on your character.
For that you need an AI setup–AI controller, Navmesh (which I believe you may not have, thus your error), and Behavior Tree. Find an AI tutorial below:
Smart Enemy AI | (Part 1: Behavior Trees) | Tutorial in Unreal Engine 5 (UE5)
Then, allow your character to be possessed by the AI controller and make it pursue/locate/investigate the point of interest or item you want it to reach. See below:
Alternatively, you could just create a spline and make your character follow that predetermined path to the goal: