Dear student
It depends on situation because in some situation magnitude of speed is same as magnitude of velocity while in some situation it may not be same. Hence sometimes we can take speed same as magnitude of velocity but not always.
Hence we can not take speed as velocity while writing the answer
With regards