Not in HTML, no - you don't have access to the user file system.
You could probably do it in javascript:
JavaScript Cookies[
^] - but most systems store it at the Server end, not the Client, and that means doing it in C#, VB, Python, or PHP. And if you are doing it server side then don;t use a text file, use a database - textfiles are not intrinsically multiuser (which websites are) so databases are a much better choice.