listText=["Car","Bike"]
for intkLoopIndex in range(0,2)
f.write(str(listText[intkLoopIndex])+ '\n')

i am using the above code to write a string onto a document.

How can i display the text in bold in the document? Can i set the font property when i write?

"Bold" is a function of the program displaying the text. In postscript it is
/Helvetica-Bold findfont % Get the basic font
11 scalefont % Scale the font
setfont % Make it the current font
You can use this if you are printing the file to a printer. For a word processor it would be different for each one, unless they use the same encoding. So insert whatever defines "bold" for the app that you are using to display the file, and then undefine bold after the word or define regular font to return to normal.