ために: The purpose of something

In order to x, y…

Nouns: Noun + の + ために + sentence
母 の ために やさい お たべる = for my mother, I eat the vegetables.

Verbs: Verb in dict. form + ために + sentence
あそぶ ために 玉 お かいます = for the purpose of playing, I buy a ball

You can chain longer sentences using 日本語を少し話すために、日本の本をたくさん読みます。In order to speak a little bit Japanese I read a lot japanese books.

The last verb defines whether the sentences is formal or casual. So you use the dictionary form + ために in the first sentence and end with ます = formal.