For one reason, she was tired of being badgered over and over with the same line of questioning. She is pushed by fear and exhaustion to confession. Secondly, and probably most important, she saw confession as a way to not only save her life, but also escape the torture of the questioning and imprisonment. By confessing and giving names of those she "saw with the Devil," they promised her relief and possibly even a trip back home to Barbados, her home.
Tituba finally "confesses" to talking to the devil at the end of Act 1 after she is repeatedly accused of doing so. She is subjected to a barrage of questions by Rev. Hale and Mr. Parris. She finally confesses because perhaps she realized that to confess would save her life. She is uneducated and superstitious, so maybe it was out of fear for her life. Mr. Parris tells her that if she doesn't confess, he will whip her to death. then Putnam immediately says that Tituba must be hanged. It's at that point that Tituba says, "No, no, don't hang Tituba! I tell him I don't desire to work for him, sir!" Quite likely, she realizes that if she is going to save her own life, she has to say she spoke with the devil. She has to go along with their accusations, but at the same time, indicate that she no longer listens to the devil and that she has tried to avoid doing the evil that the devil has tempted her with. She tells Mr. Parris that the devil has told her many times to kill him, but she has not done so. By making herself look as virtuous as possible, she is getting herself out of what appeared to be a hopeless situation.