Serial Input Text File

I am taking data from a pressure sensor from Arduino and I need to save the data in a text file. I am using processing to save the data. I am not able to figure out the code for the continuous saving of the data. Please help, I am just a beginner in the Processing

Every time the new info updates or you wanna save the data you can run the save command (for example saveStrings(). If you need further help you can provide the code and I can try to help you.

import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int intPin = 0;
Serial TianSerial;
PrintWriter Output;
void setup()
  println("setup() is running........");

  println("Serial Port Assigning Started.......");
  TianSerial = new Serial(this , Serial.list()[0] , 9600);
  println("Serial Port Assigning Ended........");
  Output = createWriter("Data.txt");  

void draw()
  if (TianSerial.available() > 0) 
    char Value = TianSerial.readChar(); 
    if ( Value != -1 ) 

void keyPressed() 

This is what I am trying but the data is not coming properly with the signals of the sensors