How to render only the shadow

How to render only the shadow from this scene?

here’s the file if anybody wants to take a look

In Cycles, you could just override the non-transparent materials with a white Diffuse BSDF.

(Eevee, on the other hand, has a shadow pass in the view-layers’ passes)

Only the light source’s shadow can be extracted.
If ambient occlusion is also needed, you can check it as well.
You can check the result in the Compositing Render Layers node.