Writing a solo is multiple Improvisations made into 1. You take your best stuff and put it together. You also can write it out on paper before even playing it out. That would probably help you do things like.. different scales for each lick. Maybe do a Dorian run and mix a quick sweep or two. Run the penatonic for lulz. Etc.
It takes me about a day just to get the solo melody down. And then another day to sit down and figure out exactly what I want to do. Sometimes i allow the improv side of me to take over.. if I dont like what I do I go back and do it again. For every section and bar.. make it all fit.