You have to open a txt file, construct your string then write to it.
import getpass
# get your username
username = getpass.getuser()
# open a txt file in append mode
log = open('username.txt', 'a')
# create your string
string = os.path.join('..','Documents and Settings',username,'Desktop')
# save and close the file
log.write(string)
log.close()
or you could use pythons 'with' statement which makes sure the file is closed properly.
import getpass
# get your username
username = getpass.getuser()
# create your string
string = os.path.join('..','Documents and Settings',username,'Desktop')
with open('username.txt') as file:
file.write(string)