If you post an incorrect answer, you should probably either correct it (perhaps after leaving a comment indicating that it is incorrect and that you are correcting it) or delete it (and you may correct your deleted answer as well, of course). You may choose to leave it if you want, but I would then suggest that you very clearly and prominently edit in a disclaimer at the top of the post saying that it is incorrect.
When I write a misguided answer, I delete it (or correct it). When I see an incorrect answer (that doesn't indicate that it's incorrect and serve some purpose in remaining), I downvote it and comment why it's wrong. [I encourage others to do the same].
I will note that I have seen a few complicated questions receive partial answers that are known to be incomplete or incorrect in some aspect. The answerers explain this in their partial answers, with the hope that some other user might see these answers and be inspired in how to fix them or make them complete. I think of this as the exception rather than the norm, but this has been very helpful at times. This is merely something to take into consideration.
See also this answer to a related question.
Something should also be said about the unbecoming comments you received. In essentially every interaction, all users should be nice and treat others with respect. If you receive or see comments that are rude or inappropriate, the correct course of action is to flag them for moderator attention.
Sometimes users get hot under the collar and make nonconstructive or rude posts. These get flagged, handled, sure. It is useful to remember that the goal of this site is not to accumulate vast hoards of imaginary internet points. The purpose is to provide a healthy, friendly community Q&A where users and visitors can find clear, excellent answers to questions they encounter at any level of mathematics.