Kindly suggest as to what I should do to fix the camera.unable to shoot picture and the phone shuts down and reboot after some time
For camera issue u might have turned on the sensors off in developer option. But i dont know about the switching off case
Back up your data if you can, and factory reset the phone or try to boot in safe mode and see if you can use the camera as normal. The fact that the camera isn't working AND the device is rebooting itself is not a good sign.
Does your camera look like the video in this thread?