I created the GUI using QTDesigner and save the file as .ui extension. Then convert the file to .py file using the following code
pyuic4 -x test.ui -o test
If all you need is the displayed text in your QTextEdit widget, you can access that by using the toPlainText() method on the widget you need the text from.
Example:
mytext = self.textEdit.toPlainText()
At this point, you can do whatever you want with mytext. You can write it to a file, you can manipulated it, etc.
If you need to (re)populate your QTextEdit with the modified value of mytext, you can do that by using setPlainText
self.textEdit.setPlainText(mytext)
To write the string to a file, you'll do something like this:
with open('somefile.txt', 'a') as f:
f.write(mytext)
This will append mytext to somefile.txt