|"while formatting it displays VGA.sys file is corrupted and the set up fails"|
Formatting means to erase the HDD & prepare it for the installation of the OS. You've apparently completed that step & are now attempting to install Windows.
"is there any problem with the hard disk"
Your problem has nothing to do with the HDD. If you formatted it properly, it's blank. The problem is either with the XP disk or the optical drive. Have a look at the disc...is it dirty or scratched?