Honest question: I often find I refer back to the rules of grammar when they prevent ambiguity or enhance clearly (often two sides of the same coin). With this phrase, what ambiguity is prevented or clarity enhanced?
It's a mechanical transformation. "End a sentence with" <-> "with which to end a sentence". As I pointed out above, vacri's version turns into an obvious jumble after this equivalent transformation, which means the original is also a jumble. It's just a more difficult jumble to untangle, so you might not notice it's wrong.
The relevant concepts here are preposition stranding and pied-piping. These are not "mechanical transformations" in the sense you mean -- there are certain constraints on when a preposition can be pied-piped and when it can't.
Maybe there's a better way to show it. But the sentence definitely has too many words in it. You could just drop the word "with" from the end and it would work fine. So "with" is a preposition, and the object seems to be the earlier word "preposition", but that word is already the object of "to use" without needing a prepositional phrase. The word "with" is tacked onto the end with no structure.