Atticus has Bob Ewell write his name to prove he is left handed and the one who hit Mayella.
Atticus’s defense is based on the premise that Tom Robinson could not physically have attacked Mayella, and that there is no evidence that she was raped. There is evidence that she was attacked, but she was hit on the right side of her face. Atticus uses the evidence of her facial injuries to create reasonable doubt about who her attacker was.
Bob Ewell doesn't understand why he is being asked to write his name.
“You’re left-handed, Mr. Ewell,” said Judge Taylor. Mr. Ewell turned angrily to the judge and said he didn’t see what his being left-handed had to do with it, that he was a Christ-fearing man and Atticus Finch was taking advantage of him. (Ch. 17)
Atticus demonstrates that Tom Robinson’s left arm is useless. If he can’t use his left arm, he can’t be the one who hit Mayella and probably isn’t the one who attacked her.
His left arm was fully twelve inches shorter than his right, and hung dead at his side. It ended in a small shriveled hand, and from as far away as the balcony I could see that it was no use to him. (Ch. 18)
Atticus goes through a lot of trouble to show that Mayella was attacked by someone who was left-handed, and that Tom Robinson is not left-handed and does not have use of his left hand. Yes, he does use his right hand well. However, he is not the one who beat her up because she was beat up by a left-handed person.
Was Mayella raped? Atticus does not directly prove that she was not. He seems to prove that no one got a doctor for her, as you would think they would if they thought she had been raped. He also seems to prove that Bob Ewell has had an inappropriate relationship with his daughter. If she was raped, it was most likely Bob Ewell that did it. Either way, Atticus creates reasonable doubt. The jury can’t believe for sure that it was Tom Robinson. Of course, it makes no difference. He is black and she is white, so they convict.