If you want to write one, learn how to code in PHP, Perl, or ASP. HTML is a markup language that can not deal with form inputs, which is what you would need for a cookie grabber. If you want to learn how to grab cookies, you'll need to learn one of the languages above (or another similar language of your choice), and learn how to execute Cross Site Scripting attacks.