The answer is: provide instruction for the illiterate.
Miracle or mystery plays can be said to be the antecedents of morality plays (the former being of biblical and religious topics and the latter being more secular but still speaking of morality). Both, with centuries separating them (miracle plays being earlier than morality plays), are forms of medieval plays which aimed at instructing the audience (and most people at that time were illiterate) on the ways of morality and the good life.