John Proctor confesses-at first- because he feels that perhaps he is unworthy to be a martyr. He knows he is not a "good" person because of his unfaithfulness. In the Puritan religion, people are brought up with the belief that sin only goes away when the appropriate punishment is doled out. Until this point, John is aware that he has not received the punishment due him for his crime. He knows that at this point the people of the village have stopped believing in the judges and the trials and that anyone dying at this point would be dying on principle not because he or she was guilty of a crime.
Proctor feels that he is not a good man, or a "saint" as he refers to Rebecca Nurse. He feels that by refusing to confess he is being a moral and "good" person, which is something he truly believes to be impossible because of his sins.
Ultimately Proctor tears up the confession because he realizes that there's more at stake than just his conscience. He knows that his sons will forever be impacted by his decision and he cannot allow them to have to live with a tainted name, as his would be sure to be if he falsely confessed.