Create an encrypted disk image in DiskUtility and copy the file there.
Text files are the most basic type of file, and cannot have any special protections in it on its own. You have to place the file in a container of some sort (ZIP file, disk image, etc) that supports password protection.