Website templates making a copy and attaching to a domain name


I don’t know how to explain this nicely or how to actually get something like this built.

It’s this:

I have a website with many HTML/CSS templates. A buyer comes, selects a template from many templates, pays for that template, chooses a domain name like [noparse][/noparse] and then gets that template on to that url ( which s/he can customise, edit and use.

Do I make any sense? Can anyone here help me how could I proceed making such a website? Any software recommendations?