Chirag B: I don't understand how they take it to be upward. Fspring=-kx always.
In this case, they define up to be positive and down to be negative. Suppose, the spring is stretched 2 m, then the displacement vector is obviously=-2i. So, then this "kx", which they use, would yield -2k, still...