Using Kinematic Equations of Motion to find Velocity in Spring-Block System Suppose a block of mass, m is connected to a spring of force constant, k. The block is moved on a frictionless surface through distance, b with the help of a uniform external force, F so that the spring gets stretched.
What will be the velocity of the block when it completes the distance, b?
Known Quantities:-
Mass - m
Force Constant - k
Distance - b
Force - F
Unknown Quantity: Velocity - v
Note: The mass of the spring and the velocity with which it is moved with the block is considered negligible in both the following methods.

Method 1:-
When the block is moved(consequently, the spring will stretch), the work done by the external force will get stored as Potential Energy(PE) in the spring and also, will appear as Kinetic Energy(KE) of the block. 
Initally, the block is at rest, so $KE_i=0$ and at equilibrium position, so $PE_i=0$
$W=\vec{F}\cdot \vec{b} = F b cos0 $
$W=Fb$
$W= \Delta PE(Spring) + \Delta KE(Block)$
$W= (PE_f - PE_i) + (KE_f - KE_i)$
$Fb= \frac{1}{2}kb^2 + \frac{1}{2}mv^2$
$v^2= \frac{2Fb-kb^2}{m}$
$v=\sqrt{\frac{b(2F-kb)}{m}}$
My book solved the problem with this method.
But I tried a different method where I used Newton's equations of motion.

Method 2:-
As the Force is uniform, so the acceleration, a produced in the block will also be uniform. So, we can apply Newton's Equations Of Motion.
$F=ma$
$a=\frac{F}{m}$
Initially, the block was at rest, so intital velocity, $u=o$.
Applying 3rd equation of motion,
$v^2=u^2+2as$
$v=\sqrt{2ab}$

Now, I just want to make sure that is the method correct or not.
If it's correct then, both the methods 1 and 2 should give same velocity.
But, that's the real problem that the values of velocity from method 1 and method 2 are not matching up.  
Please, figure me out.
 A: You got stuck with the second method because you're using an incorrect Newton's Equation of Motion. The correct  one is (the object travels on the $x$ axis), where $F$ is a constant force acting on the block:
$$ma=F-kx$$
$$m\ddot{x}+kx-F=0$$
But it's very clear that the method of conservation of energy is far simpler. Have a look at this derivation.
Substitute:
$$kx-F=X$$
So:
$$k\dot{x}=\dot{X}$$
$$k\ddot{x}=\ddot{X}\implies \ddot{x}=\frac1k\ddot{X}$$
$$\frac{m}{k}\ddot{X}+X=0$$
$$\ddot{X}+\frac kmX=0$$
So the differential equation is  now homogeneous:
Set:
$$\frac km=\omega^2$$
$$\ddot{X}+\omega^2 X=0$$
This classic second order differential equation solves to:
$$X(t)=A\cos(\omega t+\phi)$$
Where $A$ and $\phi$ are constants (amplitude and phase angle, resp.) that we determine from the initial conditions. So:
Assume at $t=0$, $x=0 \implies X(0)=-F$
$$-F=A\cos\phi$$
Assume at $t=0, \dot{x}=0 \implies \dot{X}(0)=0$.
$$\dot{X}=-A\omega\sin(\omega t+\phi)$$
$$\dot{X}(0)=-A\omega\sin\phi=0\implies \phi=0$$
$$A=-F$$
$$X(t)=-F\cos\omega t=kx(t)-F$$
$$\boxed{x(t)=\frac Fk(1-\cos\omega t)}$$
So this is the equation of motion.
And this is the expression for velocity in time:
$$\boxed{\dot{x}=\frac Fk \omega \sin \omega t}$$
Use these to find the time needed to travel the distance $b$, then use that time, say $t_b$, to determine $\dot{x}(t_b)$ with the velocity expression.
So that's quite a kerfuffle, compared to the conservation method, which explains why your textbook recommends it. The object lesson is that if you're not tasked to find the exact trajectory of the object(s), solve this kind of problem with conservation, preferably.
