write tdidf and file reader