How to read a Text file from server and store to a separate variable?

My intension is to store only the contents that are inside the text file to a variable (String).

Got the Arduino with the 4 terrabyte memory extension? If not, don't even think about using the String class.

You know (or should, or you are wasting your time) how much data is in the text file. Allocate a string (note the lower case s) big enough to hold all the data.

But here, the

client.read(); // reads single character at a time.

How many can you type at once? You can read more than once, too.

Also, It takes all the HTTP,GET, TIME parameters together.

Yes, it does.

How to store only the contents that are present in the text file to a variable

Make sure that the data stream contains some kind of "this is the start of the important data" marker, and some kind of "this is the end of the important data" marker. Read the data, ignoring it, until the "this is the start of the important data" marker arrives. Then, read and store the data until the "this is the end of the important data" marker arrives.