I assume you are talking about what happens in Act IV, here -- where Danforth wants Proctor and others to confess. He says that anyone that does not confess will hang.
Danforth's problem is that now the people who are in prison are people who are well respected in the community. They are people who are looked up to. If they get hung without confessing, people might start to rebel against Danforth and the trials.
So Danforth wants Proctor to confess so that he (Danforth) and the court do not look bad.
In the last act Danforth wants John Proctor to sign a letter confessing to his participation in acts with the devil. John agrees to do this because he and his wife had discussed that it is important for the children to grow up with their father.
However, after John has signed the paper, Danforth wants him o make a public announcement of guilt. John begins to realize that Danforth wants to use him against his neighbors to try and get them to do the same. He sees that Danforth is losing creditability and ground with the citizens. It appears that there are almost more townspeople in jail than out of jail for crimes of witchcraft and deviltry.
John knows that by making the announcement he will be harming the other people and he refuses and then states the truth. Danforth is furious because John has further undermined his authority.
Any attack on the trials, is an attack on the court system. If Danforth admits that people were wrongly accused, he would have to admit that the courts were wrong.
Danforth is all about following the strict letter of the law and the Puritan code.
John Proctor is highly respected in the Salem community. Afterall, he lives in a smaller community, Topsfield, where everyone seems prosperous including the Nurse and Corey family. The town of Salem, especially the Putnams, are jealous of the fruitful lives they are leading.
If Danforth can get Proctor to confess, then everyone will accept with 100% that there IS witchcraft in Salem and that they girls were right: they were "witched."
Proctor is the key to keeping the courts on the right side of the town. If Danforth cannot persuade Proctor to confess, then the result will be that the courts were wrong and he put innocent persons to death.