Hi Shefali,
You can also use the roles in moodle to achieve a similar result:
1. Turn editing on;
2. Click on the "Assign Roles" icon on the block (

)
3. Click the "Override Permissions" tab
4. Click "Guest"
5. Choose "Prevent" for the "View Block" capability
This is different from John's suggestion in that it will only affect this instance of the block whereas changing the code will affect all instances of the block. So just choose the solution that works best for you.
Cheers,
Shane.