I'm going to ignore your statement that you didn't realize that trying to obtain a FREE copy of XP is considered obtaining pirated software and offer you a suggestion.
When you buy hardware (especially hard drives) most retailers can sell you an OEM copy of the OS, which is significantly cheaper than retail. It won't be free, but it will be legal.