I have some doubt regarding gdp sector, while measuring gdp by income approach, we add depreciation. My doubt is: does the cost of goods that go into replacement of existing worn out capital is only treated as depreciation? Or do we also add the depreciation expense of all existing and serving goods, which have not worn out?
In theory, depreciation is a reduction of the capital stock. This includes capital assets that have actually been worn out and also capital assets that are not usable any more for any other reason (conceivably old machinery after upgrading to a new technology or so).
In practice, macroeconomic datasets infer depreciation either from what the firms in the economy in question say in their accounting or from changes in the capital stock that are not explained by any other influence (investment, dissolution and selling of the firm, ...); this is data that also comes from the firm's accounting. Note that this is not necessarily the same as the actual depreciation according to the theoretical definition since there may be any number of reasons for firms to write off capital assets early or late or at any given time. The formal rules for what practices in terms of write-offs are lawful or not are quite complicated and differ between legal systems (i.e. between countries).
Further, macroeconomic models sometimes simply assume a fixed depreciation rate which they then proceed to compute from averaging over the time series constructed from investments plus the differences in capital stock and dividing by the capital stock. This is, of course, not the way it should be done but nevertheless ...
You count the depreciation of all goods.
Lets imagine a hypothetical scenario where you buy a capital good of a tractor. The tractor will cost
$100 and last 10 years. On the tenth year you know that the tractor will explode and be completely worthless and useless meaning you'll have to buy a new tractor for
$100. Under GAAP accounting you don't record that the tractor suddenly became worthless on the 10th year. Instead you estimate in the beginning the overall lifetime of the tractor and divide that by the cost of the tractor. Thus, the tractor will depreciate by
$10 every year. You do this because it is a better indication of the value of the asset(capital good) you have left of the tractor despite the fact that the tractor may work perfectly fine for all 10 of those years.
The same is true for capital goods. You simply take the expected working life of the capital and depreciate it by its original cost every year from then on. Taken in the aggregate across all capital goods you must have equal level of investment into capital as you have depreciation in order to maintain a certain level of capital in the steady state.