I don't know the details of the specific case you have in mind, but there are a few general principles that can guide you.
Do not answer your question in the question
Answering in the question is potentially confusing (why is there an answer already in the question? is it not good enough ...? are the answers in the answer section better than this answer?), makes answers harder to find (especially if the question is long, people with a similar problem might not want to read the entire question, they are looking for answers) and undermines the voting mechanism. The idea is that answers should be judged by their merits and voted upon so that the best answer 'rises to the top'.
Answers should only be given in the answer space. Whether that means that in your specific situation you should add an answer of your own is open for debate, but adding an answer to your question is definitely worse.
Do not edit your question in a way that invalidates existing answers
If you have already gotten answers, people have invested their time to solve the original question. They deemed the question interesting enough to answer and put in effort to write up something useful. Remember that question on a Q&A site are supposed to be useful for other people as well, so even if it turns out the question and its answers did not help you as you initially expected, they may well help someone else. Destroying that by changing the question, invalidating the answers and forcing them to be edited seems like a bad idea. It creates confusion, because the question and answer don't seem to be about the same thing. Just ask a new question, questions are free.
Of course there are many edge cases here. What if you haven't gotten an answer yet? What if the original question was ambiguous or did not contain enough details? What if there was a genuine misunderstanding between question and answer? You will have to use your judgment to decide whether to edit your question in that case or to ask a new question. But I would urge you to err on the side of asking a question too much rather than invalidating existing answers.
Before you edit your question or ask a new question you can always leave a comment under the answer and ask for a few improvements. And I would urge you to do that, people are generally happy to apply small changes to their answers to accommodate your wishes. But prepare to be asked to ask a new question.
See also When is it Kosher to edit one’s own question?, Posting a question very close to an already solved one, My question has an answer which is of little use to me because of incompatibilities, Should I ask one question with many requirements instead of many questions on same topic?
Try to refrain from editing other people's answers significantly
I say 'try to' and not 'do not' because editing is an essential part of the stack exchange system. Editing typos, adding links, formatting etc. is obviously OK, but putting words or code in other people's mouths is a more delicate matter. After all, their name is still attached to the post and they will get notifications about it (not the editor).
I have on a few occasions edited other people's answers significantly (mostly to make sure the code works with newer versions of
biblatex). But usually I only do that after leaving a comment asking for the change is gone unnoticed for a long time, or if the user has not been seen for long time. I also try to keep the changes as small as possible and only modernise the code as far as necessary.
As in the point above the first step would be to leave a comment asking for the edit.
See also When is (and isn't) it acceptable to edit?, Etiquette: when is it acceptable to edit anothers' answer?
Self-answers are absolutely fine
It is absolutely fine to answer your own questions. It is still fine to answer your own question if you have gotten other answers. But you should answer the question as is: Do not answer a different question, do not answer the question you intended to ask, but failed to. Remember: People come here to look for the answer to the question-as-asked.
If you think your answer might not be an exact answer to the question-as-asked, but you still think it can be useful, ask a new question and add a self-answer immediately.
Accept the answer you want to accept
It is entirely up to you to decide which answer you accept (if at all). It may feel more polite to accept someone else's answer instead of yours, but if you genuinely feel that your answer is better, by all means, accept your own answer.
See https://tex.stackexchange.com/help/accepted-answer, https://tex.stackexchange.com/help/someone-answers, How soon should I accept an answer and when is it appropriate to accept a different answer?, (Further) guidelines on accepting answers, When is it acceptable to accept one own's answer?, Is it possible for moderators to accept an answer?, New entries not choosing best answer, should we make it more clear?
All in all I would tend towards asking a new question and possibly answering it yourself in the situation you describe. But there are many nuances, so commenting on answers first and suggesting improvements is definitely worth a try.