Object pronouns like lo, la, me, and te don't always sit in the same spot in a Spanish sentence. With a conjugated verb they come first; with an infinitive, a gerund, or a command they can move to the end and attach directly onto the verb. The rule depends on what kind of verb form they're paired with.
Before the verb is the default with any conjugated verb. Attached to the end is what happens with an infinitive, a gerund, or an affirmative command.
With a conjugated verb
With an infinitive, gerund, or affirmative command
¡Cómpralo!, pero no lo compres si es caro.
Buy it!, but don't buy it if it's expensive.
Affirmative commands attach the pronoun to the end (cómpralo); negative commands flip back to the pronoun-before-verb rule (no lo compres) -- the one case where the placement rule reverses itself depending on polarity.
Take the quiz and see if the placement rule has become second nature.