Safe values in File.txt - Help-me please

How do I save the values of my sensor in a file?
I have a parallax ping sensor, and would like to save the values in a file. To work the movement of objects on the screen, such as circles, lines and squares.
I'm using the right reading? I confess I'm confused. I have to use byte or string?
Does anyone have a better idea?

my code:

import processing.serial.*;

Serial myPort;

void setup() {
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
}

void draw() {
// Expand array size to the number of bytes you expect
byte[] inBuffer = new byte[7];
while (myPort.available() > 0) {
inBuffer = myPort.readBytes();
myPort.readBytes(inBuffer);
if (inBuffer != null) {
String myString = new String(inBuffer);
//println(myString);
createOutput(myString="/home/samuel/sketchbook/distan.txt");
}

}
}

What does the arduino code look like?

You are reading the data into processing, is that how you plan to do the graphics?

Why do you need the file storage?

Well, I do not have much practice with processing. I planned to use the values obtained by Arduino + parallax ping sensor to draw lines on the monitor according to the distance from my hand to the sensor. But I have no idea how to use these values, so I store them in text file. It could even generate circles according to the distance. Example: if I position the hand in the middle of the monitor, right there for the right to draw lines.

Example:
Youtube have one example for my idea

my code arduĂ­no used ping parallax sensor

const int pingPin = 7;

void setup() {

Serial.begin(9600);
}

void loop()
{
long duration, inches, cm;

pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);

pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);

cm = microsecondsToCentimeters(duration);

Serial.print(cm);
Serial.print("cm");
Serial.println();

delay(100);
}
long microsecondsToCentimeters(long microseconds)
{
return microseconds / 29 / 2;
}

thanks for help-me