We use the to-infinitive:
• to express purpose (to answer "Why...?"):
He bought some flowers to give to his wife.
He locked the door to keep everyone out.
We sometimes say in order to or in order not to:
We set off early in order to avoid the traffic.
They spoke quietly in order not to wake the children
… or we can say so as to or so as not to:
We set off early so as to avoid the traffic.
They spoke quietly so as not to wake the children.
• after certain verbs (see verbs followed by infinitive), particularly verbs of thinking and feeling