Not easy to fit all the best lines in, in such a short period. Also depends what your main priority is. Do you want time to actually look around the towns you visit, or are the train journeys the main priority?
One possibility just off the top of my head:
Day 1- Donny to Aberdeen then across to Inverness.
Day 2- Return to Kyle, then up to Wick
Day 3- Wick to Inverness to Edinburgh
Day 4- Early morning sleeper service (open to normal passengers from Edinburgh) to Fort William. Return to Mallaig. Back to Glasgow.
Day 5- Stranraer, Carlisle, Newcastle and home.
If you wanted to visit Oban, then miss out Stranraer. Then on day 4 make a detour to Oban on the way up to Mallaig (no point taking the sleeper if you do this, as you just end up in Crianlarich for a couple of hours). Spend the night in F William after returning from Mallaig. Or, instead of spending the night in F William, hop over the platform onto the sleeper, and head straight back down to Edinburgh. This is a late arrival into Edinburgh though.
Im pretty sure all the above is possible.
Note the above is pretty much non stop travelling though.
Especially the last couple of days. However you have a little bit of time in the nicest places. Fort William doesnt have much for it. Although it is handy for topping up on provisions. Good for an overnight stop. Supermarket next to station.
Mallaig is small, but quite pleasant. You dont need anymore than an hour there really. With the detour via Oban, you have 30mins in Mallaig with my plan.
Oban is lovely. My Oban plan gives you about 90mins on the summer timetable. Not really enough if you ask me. So if you want less travelling, try and give yourself more time in Oban. Overnight here if you can. Unfortunately my whistle stop tour doesnt allow for it
Wick is pleasant enough. Very little there, but good for an overnight stop. On a nice day a walk along the river is pleasant. A couple of very friendly B&Bs.
Aberdeen is an interesting city. If you have time, give yourself a couple of hours here to take a wander. If my whistle stop tour is too intense, this is a handy place to overnight.
Inverness is very nice. A pleasant spot for an overnight stop.
Kyle has nothing much at all. May as well take the same train straight back. Do take a trip there though, as the train journey is amazing.
Things ive missed out, but are worth doing if you want to do something different:
Stirling- Worth a visit if you can.
Wemyss Bay. Pleasant enough journey, and a very nice little station. Consider taking the ferry over to Rothesay. If you do, make sure you visit the toilets right by the harbour.
North Berwick- On a nice day, a very pleasant little town to spend a couple of hours. Dont bother if its raining though. (Note, probably wouldnt be on my list for a 5 day trip)
If i think of anything else, I will add it later.