Viewport render gives the desired result but the actual render shows a black screen
The problem is really simple. Actually you have gone to the compositor and deleted the render output which will stop anything from being rendered. Either add these two nodes back in the compositor:
Or either just uncheck the compositing and sequencer boxes so they don't affect your render:
After doing this the render works at my end.