My doubt arises due to the following :
We know that the definition of the derivative of a function at a point $x=a$, if it is differentiable at $a$, is: $$f'(a) = \lim_{h \rightarrow 0} \frac {f(a+h) - f(a)}{h}$$
Suppose that the function $f(x)$ is differentiable in a finite interval $[c,d]$ and $a \in (c,d) $
So, we can apply L'Hopital's rule. On differentiating numerator and denominator with respect to $h$, we get: $$f'(a) = \lim_{h \rightarrow 0} \frac {f(a+h) - f(a)}{h} = \lim_{h \rightarrow 0} \frac {f'(a+h)}{1}$$ Which implies that $$f'(a) = \lim_{h \rightarrow 0} f'(a+h)$$ Which means that the function $f'(x)$ is continuous at $x=a$
But this not necessarily true. A function may have a derivative everywhere but its derivative may not be continuous at some point. One of many counterexamples is: $$f(x) = \begin{cases} 0 \text{ ; if x=0} \\ x^2 \sin \frac{1}{x} \text{; if x $\neq$ 0 } \end{cases}$$ Whose derivative isn't continuous at $0$
So, is something wrong with what I have done ? Or is it necessary that for applying L'Hopital's rule, the function's derivative must be a continuous function?
If the latter is true, why does that condition appear in the proof for L'Hopital's rule ?
In this case - yes, you need derivative to be continuous. In general, you need $\lim \frac{f'(x)}{g'(x)}$ to exist to apply L'Hospital's rule. As in your case $g'(x) = 1$, you proved that if there is a limit of $f'(a + h)$, then the limit is equal to $f'(a)$.