Prepositions often describe the position of something, the time when something happens or the way in which something is done. The prepositions "of", "to" and "for" have other functions.
Prepositions may sometimes be used to end sentences. For example, "What did you put that there for?" (better English is the alternative: "Why did you put that there?") Example 2: "A pen is a device to write with" (better English is "A pen is a writing device"). In general, because they are links, prepositions belong in the middle of sentences, rather than at the end.