My handwriting is terrible.
I go through phases of practicing my handwriting, letter by letter, page after page. It improves, temporarily, then reverts to illegibility.
The main thing I have to work on is not gripping the pen too tightly. The other thing is not thinking too far ahead of what I’m writing, otherwise I tend to skip words, or two different words will blend into one as I write, and what emerges is gibberish.
As for randomly switching between upper and lower case, often mid-word, that’s beyond my control.