The key grammar point you are looking for is "relative clause".
The main sentence here is:
He/she/the teacher made the student write an apology
We can describe what kind of student it was with a relative clause (the part in bold):
The student who broke the school's window
The whole relative ...
You aren't wrong that there are two objects marked by を, but there are also two verbs, 割った and 書かせました. This should give you a clue that the sentence is complex in some sense. The reason is that the first part of your sentence is a noun phrase (a relative clause).
Looking at this example, it is the noun 生徒 that is being modified to give you a more complex ...