I think the logic in your program is somewhat flaw.

You only read the value from the first line of the file you open and after that you loop through each line in the file reading in each line and...