We sometimes confuse an infinitive with a prepositional phrase because they both use the word to.
An infinitive uses the word to with a verb. I want to walk. I need to hear your story.
The word to can also be a preposition. The word to is used as a preposition if it comes before a noun.
That noun is the object of the preposition. I am going to school. I wrote a letter to Susan.
When you join the word to with a verb, you are using an infinitive. When you join the word to with a noun, you are using a preposition.