First, Proctor is trying to discredit Abigail's character. If he can do that, he can not only save his wife but also many of his friends and neighbors who stand accused.
The purpose of the court is to rid Satan from Puritan soil. They are the high power in the land. One flaw that the Puritan's had was that there was no separation of church and state. They do not need witnesses because they allow spectral evidence (the visions and lunacy the girls seem to suffer from). This is dangerous because who knows whether the spectral evidence is real or simply imagined.
Proctor confesses lechery because he is trying to prove that Abigail is not as saintly as she appears. If he can prove she is sinful, then he can free his wife from prison and possible death.
The courts purpose in this drama is to locate witches based on the girls testimonies. The girls are the witnesses that the court chooses to listen to. If one of them cries out against someone, then they are automatically accused. Also, the girls pretend to be bothered by the spirits of the accused in court and this is used as evidence in the place of other eye witnesses.