In this case it will be a hack (since you want to add to the template); however the "base" funcitonality you're looking for is already there.
Quoting myself from
here:
There are 5 "custom" fields; you'd generally just use those (by naming them); see:
CP -> Membership -> Registration Settings -> Registration Screen (tab)
They're at the bottom of the page.