to have to do something means "to be required to do it" or "to find it necessary to do it".
I have to go to the dentist tomorrow.
I had to go to the dentist yesterday.
In this drought, if you want to get wet, you have to take a shower.
There is no rain to stand in.
If we add only to such a statement, the necessity is not removed; only implies that what needs to be done is not difficult to do. There is one simple thing to be done.
If you want to get your clothes all wet on Fifth Avenue, you have only to stand on the sidewalk next to a puddle and wait for a car to go by.
All you have to do is stand on the sidewalk next to a puddle and wait for a car to go by. Easy-peasy. Instant sopping mess.
If you want to watch TV, you have only to click this button on the remote control.
So, all he had to do was allow his sheep to determine the route and then new and interesting things could be discovered. He had to give up control and let the sheep decide.