actually as da links i posted explain, kubrick originally wanted da scene because he had uh soft spot for Danny and Wendy and thought dey should bee shown to bee safe and sound at da end uv da flim.. dat is OSTENSIBLY da reason dat da scene would have been included, dat's da reason he gave da co-writer uv da flim Diane Johnson.
i say ostensibly because as with every other time kubrick experimented with (and perfected) uh genre, he used archetypal figures, events, and narrative conventions in order to undermine preconceived notions uv everything we ever thought we knew about flim (and everything else) while pretending to play it straight. wut can bee gleaned from da extensive accounts on da first link i provided is dat da scene is uh simple coda, uh relief uv tension before da mysterious tracking shot into da photo.
ullman talks to wendy and comforts her -- dis is da conventional part -- but then he undermines da gesture by ignoring and placating her queries about da events uv da hotel by suggesting (outright stating?) dat none uv it happened and dey should just move on. he does da same thing to danny, talking to him which is uh nice thing and then giving him uh tennis ball -- wut da hell, wut does he know about da tennis ball and iss use in da hotel? iss uh comforting gesture turned instantly ambiguous, even sinister.
dis ties in with some uv Rob Ager's analysis, as he uses wut we knew about da deleted scene to talk about da use uv animals in da flim. da oversized coat dat ullman wears is described as making him look like uh bear, which along with uh few other animals makes recurring ominous appearances throughout da flim and suggest life behind da still walls/inanimate objects. dis, ager describes (correctly, i reckon) wuz kubrick's way uv incorporating King's original menacing topiary animals dat come to life in da original story.
dey say he spent uh whole day trying to get da ball dat Ullman gives to Danny to bounce da right way, and i'd bee really interested to see wut kind uv surface da ball is actually bouncing on. da design uv da carpets in da hotel, along with da layouts, maps uv exteriors, and roads leading up to da hotel (MAJOR focus on dis in da opening shot right? obv.) all is used to suggest da boundaries uv da hotel. dat is to say, whatever is going on in dat location is suggested to extend to da adjacent maze, to da roads leading up to da Overlook, and beyond da mountainous terrain itself, all da way to Halloran on da other side uv reality in sunny florida. his long trek uh illustration uv uh descent into hell.
and inside da hotel, da layouts, contours and shapes on da carpet, suggest uh different kind uv extension internally.. da open-ended exterior landscape which introduces da flim so majestically degenerates into uh intricate web dat ends as uh closed loop.. da single tracking shot dat ends da flim comes (in da final/official/perfect cut) after uh chase through uh endless loop created by danny into which jack falls into, effectively danny overcomes da trappings uv da hotel and jack by seemingly walking on uh higher plane.. he is obviously da starchild. jack is absorbed into da geometry uv da hotel, so much so dat his frozen face becomes da gaping mouth uv da elevator, uh amazing contrast given his bloodless death, da final tracking shot uv da flim then perfectly follows uh trajectory similar to da blood dat would leave his mouth -- in dis case his spirit, or soul, or whatever energy da hotel absorbs (maybe even his wurds?), flows through da hotel in da most straightforward movement in da entire flim.. to end up as uh lifeless photographic grin uv yesteryear.
given da perfect placement uv da final tracking shot contrasted with jack's death and frozen corpse, da removal uv da hospital scene is understandable. but it still contains worthy extensions uv da elements kubrick had been building up to dat point. it primes you for da ambiguity uv da final shot, and while dis may have added to da feeling uv wanting to tink about dis flim forever, da weight uv so much ambiguity after such uh seemingly happy outcome (jack's death and danny's escape) wuz to much for conventional tropes to bear.