I'm going to leave during a 9 hour shift in work in which there is no coverage
Why are you going to leave work in the middle of a shift? That seems irresponsible.
I've written it on my work schedule that I am taking leave at around 4 PM today because I'm going to a doctor's appointment.
It is fine to leave in the middle of a shift if you gave advance notice that you have a doctor's appointment. Management should plan for this.
I agree. I let my boss know about it weeks ago.
It's unfortunate for your workplace, but if you let them know then you shouldn't feel bad about leaving. A doctor's appointment is a reasonable reason to ask for time off.