Hi Minoli,
The reason that blood doesn't spontaneously clot inside blood vessels is due to the secretion of different compounds from the vessel wall. Normal (structurally intact) endothelial cells lining your blood vessels release prostacyclin and nitric oxide (NO). These compounds block platelet adhesion and aggregation, allowing the coagulation to happen only when there is damage to a blood vessel. The damaged vessels expose collagen, which is what triggers the coagulation cascade leading to a clot.