Yet, I find myself making mistakes and reworking code constantly. Is there a better approach or a structured methodology that I should follow?
Some decades ago some people believed that there would be a better methodology and called it "waterfall model". But nowadays its widely accepted that when trying to develop a non-trivial program, you will almost never "get it right" on the first shot - even if you are very experienced. There will be bugs, requirements and edge cases you overlooked at the first sight, performance considerations, necessary design improvements only getting visible when your program reaches a certain size, and some things more.
IMHO the key point for professionalism is learning to manage the changes. This starts with simple things like a priority list of open requirements, making some design considerations before coding (like the ones have described in your comment), the use of version control (to keep track of any changes), and it goes further with release planning, automatic tests (to make sure future changes don't break existing behaviour) and application of the SOLID principles.