while (myFile.available()) {
Serial.write(myFile.read());
// here the code I tried to read .txt file and store it in long
savednum = myFile.read();
Serial.println(savednum);
}
You wrote "123456789245678918" into the file.
Then, you read and write (why you are sending ACSII data in binary mode is a mystery) the '1' without using it in any way. Then, you read the '2', and store the one byte in a 4 byte variable, and then print that. You repeat that for the '3' and '4', the '5' and '6', the '7' and '8', the '9' and '', the '', etc.
Probably NOT what you meant to do.
You need to read and store all the characters, in an array, until you get a '', appending a NULL after each character. When you go get a '', call atol() with the array, and store the returned value in longnum, and then print that.