I found out how it works. There are three different imperative forms:
To write is yazmak (=infinitive). If you take the infinitive form and drop -mak (or -mek), you get the verb stem which is also the imperative form for 2nd person singular. Yaz = write! (2nd person singular, as in German "schreib!").
The second form is verb stem + In: yaz + (y)In (-ın) = yazın = write! (2nd person plural, as in German "schreibt!"). /edit: or polite, see Selcen_Ozturk's comment below
The third form is verb stem + InIz: yaz + (y)InIz (-ınız) = yazınız = write! (polite singular or plural, as in German "schreiben Sie!").
"-yı" is the accusative suffix. Something takes the accusative suffix if it is a "specific direct object," which pretty much means something is being done to it and the definite article "the" is used. The apple is being eaten and in English the word "the" is used before it, so it's in the accusative case and therefore takes the accusative suffix. Does it make more sense now?