An H-4 visa ("immediate family member of H-1B visa holder") makes you a legal resident alien. You are perfectly legal to purchase, own, and possess firearms. Don't rush to sell your pistol.
As others have said, the CHL course is not a gun safety training class. There are lots of good training classes available; check for the NRA Basic Pistol course, or NRA Personal Protection in the Home course. The CHL course deals with Texas law, and tests for basic proficiency with a handgun.
The SSN requirement for the CHL is an obstacle, but I think it can probably be overcome, depending on how much time you want to spend battering down that wall. The
only reason the SSN is required, is to make sure you've paid child support. You can't provide an SSN if you neither have, nor or eligible for, that number. I would write "none" in that space, and add an attached statement that you neither owe nor pay child support (assuming that is the case).
Good luck with it.
Oh, and if you are ever in the Northeast Texas area, and wish to pay tribute to your countrymen by making noise with some Lee-Enfield rifles, I'm your man. Give me a shout, and we'll burn up some .303.
Kevin