I have one doubt
in light conditions the transistor's resistance is less so we get low voltage
Yes, the more light, the lower the output.
but since we have used the resistance R2 higher than the resistance of the transistor in dark condition how would we get the output close to maximum?
R2 is not
higher than the resistance of the photo transistor in dark condition - if totally screened from light, the transistor will be completely off (= extremely high resistance).
What the resistance will be, with the LEDs on, but over a dark (non-reflective) surface, depends on the specific photo transistor and you'll have to measure the voltage and adjust R2 if needed - I thought you read the other thread?
or would would be somewhere close to half of Vcc(i.e. 5V)?
Only when the photo transistor equals R2 will it be at 2.5V
Perhaps read the other thread once more and then experiment, experiment and experiment - that's how you get the connection between theory and real world application.