Advantages of differentiability?

in linear regression , we squared the loss function and said that since it is differentiable, we squared that, so whats the reason behind it, why did we do this?