Untuk plus a noun
Ini untuk kamu. ‘This is for you.’
Obat untuk sakit kepala. ‘Medicine for a headache.’
Untuk plus a verb
Saya datang untuk belajar. ‘I came to study.’
Uang untuk beli motor. ‘Money to buy a motorbike.’
The verb after untuk stays bare. No infinitive marker, because there are no verb forms to mark.
Supaya plus a clause
Supaya needs a whole clause after it, with its own subject.
Saya belajar supaya bisa bicara. ‘I study so that I can speak.’
Tutup pintunya supaya nyamuk tidak masuk. ‘Close the door so the mosquitoes don’t get in.’
The difference in one line
Untuk points at a purpose. Supaya points at a result you want to happen.
Saya beli obat untuk sakit kepala. The medicine is for headaches.
Saya minum obat supaya tidak sakit kepala. I take it so I won’t get a headache.
If what follows has its own subject and verb, you need supaya. If it is a noun or a bare verb, untuk.
Buat, the casual one
Buat replaces untuk in speech almost entirely.
Ini buat kamu. ‘This is for you.’
Confusingly, buat also means ‘to make’. Buat kopi is ‘make coffee’ in one sentence and ‘for coffee’ in another, and only the surrounding words tell you which.
Agar
Agar is supaya in formal register. It appears in official notices and instruction manuals.
What the book says: Agar tidak terjadi kesalahan, mohon diperiksa kembali.
What you’ll hear: Dicek lagi ya, supaya nggak salah.