When a verb ends with er: it is an infinitive Whereas: when a verb ends with é it is past tense
A way to make the difference while writing Is: replace the verb by a 3rd verb group and see if it makes sense.
For example: Il faut allé a l'école. AND NOT il faut aller a l'écoleReplace the verb aller with a 3rd verb group such as faire: It makes more sense saying: il faut faire a l'école, THAN il faut fais a l'école
Therefore, you must use the past tense of aller which is allé.