Endogenous Growth in the case of externalities (Learning by doing)
You don’t explain what $w$ even is but I will assume it’s wage. The wage increases with the capital accumulation for several reasons. First, as the capital becomes more abundant the labor inputs become relatively more scarce and hence more valuable. Thus, also the price of labor relatively to capital should increase through higher wages.

Second, in most commonly used production function capital needs to be used with labor for example with standard Cobb-Douglass production function $AK^{\alpha}L^{1-\alpha}$ if you only use capital and no labor output is 0 no matter how much capital you employ. Hence using these kind of production function imply that when the capital stock increases, demand for labor increases as well putting more pressure on wages.

Another way how to think about it more intuitively is to think about labor productivity. It’s well established that wages vary positively with labor productivity and working with more capital makes people more productive hence increasing their wages.