After a light ray gets refracted at the boundary of a refracting medium, why do sent the light ray keep refracting inside. Cause if you divide the medium into many boundary layers then light should keep refracting inside. There is no way each layer in the medium can know that refracred ray has already been refracted. So the light ray must bend. Please bring out the fundamental flaw in this question.
If I understand your question correctly, the answer is the light does keep refracting inside the second medium. Let me explain what I mean:
Let's, as you suggest, divide the second medium into layers. Assuming the medium is homogeneous, the index of refraction of each layer is the same! They're all made of the same material.
So, if we apply Snell's Law of Refraction:
$$n_1 \sin(\theta_1) = n_2 \sin(\theta_2)$$
But $n_1 = n_2$ for every one of our layers: $$n_1 \sin(\theta_1) = n_1 \sin(\theta_2)$$ $$\sin(\theta_1) = \sin(\theta_2)$$ $$\theta_1 = \theta_2$$
So what do we conclude? That for each of the layers we've divided our medium up into, the angle of incidence is the same as the angle of refraction. What does that look like? A straight line!
So yes, in a sense, the light beam is continuously refracting. However, you only see a change in direction of the light beam when the index of refraction changes, for example at a boundary between two different media.