So, here's an example of the input:
blah 20 10 100503 location
How many spaces are there? I see 4. So why are you doing:
>>if (count != 5)
>>if (startkm > endkm)
>>Invalid. Start km must be greater than end km
You're test doesn't match your error message.
The variables startkm and endkm are double, and as such, sscanf() and fprintf() will need to be told they're %lf, not %d as you currently have.
If you really want to use sscanf() to grab the two numbers from the input line, I suggest you do it like so:
You might also want to investigate grabbing the string inputs at the same time (name/date/location)
if (sscanf(line, "%*s %lf %lf", &startkm, &endkm) != 2)
fprintf ("Two numbers were not read in\n");
/* Handle error */
And code tags use  brackets on these forums, not <>