@nusha , nuha, you could disassemble and check and clean the connections, also make sure the camera is locked into the correct position and see if that helps, if not you may have to replace the camera.
Below are a couple links to your device, they will show how you can get inside phone to access camera. 1st link is tear down of device, 2nd link is service manual. Also I posted links to a couple forums that trouble shoot your issue, If you google your Nokia Lumia 1020 camera not focusing problem, you will see there is a lot of info. out there. Good luck.
I hope this helped you out, if so let me know by pressing the helpful button.
[[Topic:Nokia Lumia 1020]]
http://devdb.ru/data/file/file5245f74f499056.03810084.pdf
https://forum.xda-developers.com/lumia-1020/general/focusing-problems-lumia-1020-try-crazy-t3160711
http://forums.windowscentral.com/nokia-lumia-1020/251341-lumia-1020-auto-focus-malfunction.html