Capacitance of the portion with dielectrics,

C1 = Kε0A/ld
Capacitance of the portion without dielectrics,
C2 = ε0(l - a)A/ld

Consider the motion of dielectric in the capacitor.
Let it further move a distance dx, which causes an increase of capacitance by dc
∴ dQ = (dc)E
The work done by the battery dw = Vdg = E (dc) E = E2 dc
Let force acting on it be f
∴ Work done by the force during the displacement, dx = fdx
∴ Increase in energy stored in the capacitor

