Here's the answer:
“nous avons suivi la rivière pour que nous ne nous perdions pas”
Watch a real native speaker say it:
Here's how it sounds in a textbook:
Fun fact: the hundreds of thousands of people learning French with Memrise get this phrase correct 89.95% of the time!