I have a Nikon D5200 with the 18-105 kit lens. I cannot focus the objects which are 15-20 cm away from the lens. Can anyone tell me how to manipulate the settings so that i can focus those objects? Also doesn't clicks the images which are out of focus or the objects which are totally out of focus..
According to the specifications, the 18-105 has a minimum focus distance of 45cm. This is measured from the focal plane of the camera, so is probably further away than 15-20cm from the lens. If you want to focus on things closer than that, you will need a macro lens, known as a micro lens in the Nikon world, or alternatively some extension tubes.
Each lens has a minimum focus distance, which is 45cm for your lens, likely at 18mm, which is not bad for a superzoom.
If you want to focus closer you would have to use a macro lens (which is a lens dedicated to close focusing) or use other means to allow your own lens to focus closer. Those are diopter filters and extension tubes. The three solutions can be easily found in other questions about macro photography so I won't detail them here any further and there are advantages and disadvantages to them all, with dedicated lenses of course giving the best quality and ease of use but at a disadvantage of weight, volume and price.
With just that lens you won't be able to focus on anything closer than 1.48 feet = 45 cm as per the lens specs. You might consider investing in a 100mm macro lens.
Edit: To answer the second part of your question, it won't click the shutter because the camera knows that it's not focused. If you set the lens to manually focus the shutter button will take a picture even if it is out of focus.
Each lens has a minimum focus distance. When you want to focus closer than the minimum focus distance, you need an extension tube, but I don't know if your lens is compatible with one.
Alternatively, if you need high quality and close zoom photos, the best option is to buy a macro lens.