what is the difference between raycast and getmousebuttondown in a RTS game ?

they both are doing the same job when i use them in selection of an unit(soldier)
so what is the difference ?

These two things are really not the same at all (though they can be used to achieve similar effects).

Input.GetMouseButtonDown is true only on the frame during which the specified mouse button is pressed.

Physics.Raycast is true only when a ray extending from some origin in some direction for some distance meets a collider (on some layer). If no collider is detected, it is false.

These two methods give you vastly different information about the current state of your game/application.