Your mistake was not doing a search of the forum. There you'd find dozens, if not hundreds of existing threads that ask and answer the same question.
You didn't give us much information to go on but if you wrote the correct stock firmware without errors and wiped the system cache, then a factory data reset will correct your issue. If you have ongoing issues, then provide us with a lot more information so that we can effectively help you. For a start, a detailed, step by step description of exactly what you tried, your phone model, firmware versions, verbatim error messages and anything else germane.