I am banned from writing answers, and all the answers I wrote, the question has been already been deleted by someone. Actually they were homework questions and I answered them, so it is not acceptable that I get banned right? What can I do?
Simple: don't write answers to questions that are going to get deleted.
Homework questions get deleted for a reason: we don't want them here. If you answer poor-quality homework questions, you are nullifying the effect of the homework policy and you are providing an incentive for the users whose questions you answer (as well as others who see that those askers got their queries resolved) to post more poor-quality homework questions. That brings the site's content quality down, and it makes it harder for us to retain the expert users that provide the high-quality answers that make this site great.
So: you've posted a bunch of answers that negatively impact the site's quality as perceived by this site's community, and as a consequence the system is no longer accepting answers from your account ─ that sounds like the system working as intended.
As to your current options, it depends on how bad the answer ban is, and that information is not available to regular users, and it is only partially available to our elected site moderators. For one, you should read very carefully the guidance on the main meta site,
but it does seem like your account is in pretty dire straits as the answer ban will not time out on its own until you fix your posts (which you cannot do given the poor quality of the questions you chose to answer).
Fixing this goes beyond the powers of regular users or site moderators, so I would recommend that (i) you fix whatever answers you can fix, and then (ii) you contact the Stack Exchange team, linking to this thread, and explain that you are prevented from fixing the remaining answers. If you make a convincing case that you won't be answering questions that are liable to get closed and/or deleted shortly after your answer, then I suspect that you have a better chance of the answer ban getting lifted.