Could you please elaborate. How would you say I buy it for you?
We use the preposition por (not para) to indicate price. Read and listen to these examples:
Examples and resources
Q&A Forum 1 question, 2 answers
Te la compro. I do not understand the logic behind it
In this sentence:
"Me encanta tu chaqueta. Te la compro por 20 euros."
(I love your jacket. I'll buy it from you for 20 euros.)
If we analyse the second part "te la compro", we have "I buy" (compro), "it" (la) and that pronoun "te" can mean either "from you" ,"for you" or "to you", or even "on you". In this case, we can see by the context that it means "from you". Take this other sentence for example where "te" means "for you":
"Si te gusta mucho esa chaqueta, yo te la compro" -> If you really like that jacket I'll buy it for you.
Here are other sentences doing the same thing:
Tengo su número de teléfono. Me lo dio Cristina. (I've got his number. Cristina gave it to me.)
Tu madre te puso un sombrero. (Your mum put a hat on you)
Le escribí una canción. (I wrote a song to him/for him)
I hope this helps.