I'm not entirely clear what you're saying the problem is. I'm seeing two different ways to interpret what you've said in your opening post. I'm going to explain what I think each interpretation is. Please let me know if either of them is a correct understanding of the problem, and if not, please provide further clarification.
It seems you are either describing:
A) You are easily distracted when working on problems. When you think of an answer, your mind wanders, and you then end up writing something incorrect.
or
B) You stay focused on the problem, and are thinking the right answer. But, when it is time to write the answer, there is some "miscommunication" between your thoughts and your writing.
Your clarification in reply #3 makes it sound more like B than A. But is that a correct understanding?
If so, do you have the same problems in oral communication as in written communication? In other words, if a teacher asked you to solve 2+2, would you say the correct answer out loud, but then write it down wrong, or would you think "4" but say or write something else?
Does it only happen with math problems, or in other subjects as well? I ask because I see some things in your writing here that are also somewhat oddly written. That might all be part of the same problem, or you may have just been careless in writing quickly to post here. It will be important to determine if it is a situation specific problem (only in math) or generalized (anything you write) in order to better sort out the source of the problem and how to deal with it.
In any case, you may want to consider being evaluated for a learning disability. If you can think the right answer, but then write the wrong answer, it would suggest there is a problem connecting your thoughts/problem solving ability with your motor function/writing ability. If the problem is only in written work, you may be able to seek accomodation by doing assignments and exams orally. If the problem is distraction, you may want to find out if you have a form of ADD (or start by eliminating other things that may make you more easily distracted, such as too much caffeine or improper nutrition or insufficient sleep at night...all of those things can lead to easy distraction/difficulty staying focused without being ADD, and are easily remedied with dietary/behavioral changes).
If you have never checked, the first step might be to sit down with your teacher and work through problems orally to see if you are only writing things wrong or also saying things wrong.
In the interim, check and double check and triple check all your work before turning it in. Look specifically for those types of mistakes to try to catch them, and don't rush through assignments (such mistakes can happen out of plain old-fashioned carelessness too).