Saving Arduino sensor data to a text file
you can write the sensor data to the serial port using serial-lib and 
write a small processing program that reads the data from the serial port and writes it to a file. 

in the arduino code initalize the serial lib in the setup method 

Serial.begin(9600);


and write your sensor values to the serial interface using 

Serial.println(value);


in your loop method

on the processing side use a PrintWriter to write the data read from the serial port to a file 

import processing.serial.*;
Serial mySerial;
PrintWriter output;
void setup() {
   mySerial = new Serial( this, Serial.list()[0], 9600 );
   output = createWriter( "data.txt" );
}
void draw() {
    if (mySerial.available() &gt; 0 ) {
         String value = mySerial.readString();
         if ( value != null ) {
              output.println( value );
         }
    }
}

void keyPressed() {
    output.flush();  // Writes the remaining data to the file
    output.close();  // Finishes the file
    exit();  // Stops the program
}