That prepositional phrase is functioning as an adjective and as such is not movable within the sentence, but must abut (or sit on the other side of a verb of being of) its noun.
Dear student: 1) Select “on end.” 2) Cut “on end.” 3) Move cursor to follow “weeks.” 4) Paste.
Did “He left her alone for weeks” seem too, well, simple? Was the student afraid that the reader might not understand that these weeks were sequential? Did he want the reader to experience the tedium or sense of abandonment involved in this stretch of solitary weeks? But any of these possibilities would have impelled the addition of “on end” following weeks, which is where it belongs. How did “on end” get in there after “alone”?
These inexplicable errors nevertheless yield moments of delight for the reader. Which end of her was she on? Was she standing up, possibly sitting down (on her “rear end”), or, most enticing possibility, standing on her head? To be left in any of those positions for weeks would certainly be tedious, or painful, or exhausting; it would certainly induce a feeling of abandonment.
But a kindly English instructor must rescue her from her pain, despair, and indignity, and show the student where to put that modifier.