In order to solve problems well, one needs to really understand the problem at hand, exploring all nuances and adjacent ideas, which requires extensive thinking.
Thinking is a complex function, it requires us to hold multiple thoughts and ideas in our head simultaneously. These thoughts are often related to each other in multiple ways, and our brains have to process the relationships amongst them. Sometimes, some of these ideas are directly in conflict with each other, and the brain has to spend resources handling this polarity.
This is only the beginning, as our brains also have to run various what-if scenarios/simulations, trying to figure out the best course of action in the pursuit of solving the problem at hand. Through these simulations, we may sometimes discover that certain ideas don't really make much sense or are flat out wrong, requiring us to course-correct and start all over again (but from a much more informed state).
Running these mental gymnastics in our head is a lot of work and there is only so much that our mushy organ can hold. If one has a lot of experience in the field/realm that they're working on (to solve the problem), then they have an advantage (see chunking) as they likely would've already thought through some of the related ideas (perhaps while solving related problems before) and can move faster with less working memory needed.
But what about solving problems in entirely new fields, or new unseen problem spaces at the frontiers of existing fields? (or you could also just have ADHD). Such situations make it hard to hold multiple things in our head and process them at the same time (as you cannot benefit from chunking), requiring significant effort/resources, but there's a sneaky little hack — writing!
Writing allows us to pen down our thoughts and ideas onto paper (or a screen), freeing up our mind to only play around with ideas immediately needed, without worrying about forgetting other adjacent, but not immediately needed ones. It is the equivalent of your computer storing data in a Pagefile (see memory paging) when it runs out of RAM. Writing also affords you the luxury of saving your progress somewhere (like in a video game) before resuming to work on it again later on.
Not only can you store ideas, but also conclusions from simulations, so that you can compare them with your other conclusions without worry of forgetting anything. You also unlock the ability to work on one part of the problem and quickly jump to solve another unrelated part, and eventually joining all the large pieces together to form the whole, without having to necessarily follow a linear path (really helpful if you're a divergent thinker). Writing gives you the ability of being able to deal with one tree at a time, while also being able to piece together a forest by the end.
The Second Capability Unlocked by Writing — Clarified Thinking
Writing well forces you to think clearly, and thinking clearly is hard. When you write, you are forced to structure your thoughts before presenting them to the reader (or yourself if you're writing privately) to keep things digestible for the other person to understand. This forced clarity helps you understand the problem better, and in the process you're also likely to gain additional insights.
Once you actually pen down a few words/sentences, you get to read what the ideas actually look/sound like, eliciting an emotional, yet subtle response from within you (if you pay close attention, you'll notice it). This response validates whether what you just read makes sense or not. If you listen to it, it will act as a guide, instructing you on what parts make sense to pursue further, what parts to tweak/correct, and what parts to drop entirely.
With this newfound information/feedback from within, you'll pen down your changes and further keep validating what you've written through this inner voice. As you keep iterating over and over again, you'll not only be left with something very polished, but you'll also have understood the problem well enough to (hopefully) have a solution to whatever it is that you've decided to grapple with by the end.
Therapy (certain kinds, not all) also works similarly, wherein the therapist helps you talk to yourself by asking the right questions, acknowledging your responses, and following up with further strategic questions. When I was a teenager, I volunteered for 7Cups (an online mental health platform focused on active listening) where I learnt this skill and it has helped me quite a lot ever since. Highly recommend you check out the platform, and maybe even volunteer if you have some spare time! :)
In a Nutshell
Solving problems require considerable effort and writing is a tool which can help you navigate the complexity by taking some of the load off of your brain, helping you deal with one-aspect of the problem at a time. Writing also helps you take a break and recharge, before attempting to solve the problem again given that your progress is documented and saved. An additional benefit apart from the logistical support provided, writing also sharpens your thinking by helping you reach clarity of thought, through an iterative write-and-rewrite process.