Getting coordinates

I’m trying to make a entity that will walk to a specific point in the world (that point being a structure). The problem is: I don’t know how to get the /locate command result to set it’s coordinates as the destination for said entity. Maybe the problem is using locate, but in that case I don’t know other way to achieve this
Continue to help post