The answer
God created the angels before the creation of the world and before time. They were created holy, but given free will, just like human beings. They had a period of test, and so, those who stayed holy remained in heaven and from the end of that period of test unto eternity, they cannot sin. Those who did not remain holy, such as Satan, were cast out and condemned.
H.G. Bishop Moussa