Isn't that first-hand embarrassment, aka just regular embarrassment?
Second-hand embarrassment is when you feel embarrassed on behalf of someone else who did something embarrassing. Kinda like cringe, except more sympathetic.
Anyway, I used to kinda feel this way while doing fanart. I think the key to getting over it is 1. realize that no one fucking cares, you're not that important and 2. Have some objective standards for measuring how good your writing is or some goals to achieve with it. Maybe find something you like about someone else's writing that you'd like to incorporate into your own. That way you can find flaws with yourself, but also have a basis for it and improve at your craft.
Basically if you think your writing is shit, focus on making it better in some way rather than just wallow in self-pity.