Moving mass problem: complete solution with the effect of initial conditions