thanked him/her for
Le agradecí por prestarme un libro.
I thanked him for lending me a book.
Le agradecí por haberme ayudado.
I thanked him for helping me.
Yo le agradecí por lo que había hecho.
I thanked him for what he had done.
Le agradecí por el bonito presente.
I thanked him for the lovely gift.