In your example, “in” is a preposition, so it cannot be used without an object, therefore, we can either leave it out, or use “it” as an object. If a preposition has an object (as required), the preposition will come immediately before its object. On the other hand, in a relative clause, or in a question (with the question word fronted), the preposition can optionally be placed at the end of the phrase: He has a bed in which to sleep / He has a bed to sleep in. To where are you going? / Where are you going to? In modern usage, the preposition usually comes at the end.
Finally, when a preposition is used as an adverbial particle, it most certainly can end a sentence: This morning, I slept in. To “sleep in” is a phrasal verb meaning to get up later than usual. In this case, the “preposition” is not really a preposition at all.