HOW can i read form sd card on ethernet shield and write to file.txt instead of writing to Serial
You can't. The only way for the Arduino to talk to your PC is via the serial port, which requires some other application on the PC to be connected to the other end.