There are a few reasons why Mercury and Venus don't have moons.
First, both planets are relatively close to the Sun. In order for a planet to have a moon, it needs to have formed from a rotating disk of gas and dust surrounding the planet. However, the strong gravitational pull of the Sun disrupts the formation of moons close to it, preventing the accumulation of enough material to form a moon.
Second, their proximity to the Sun also makes it difficult for them to capture moons that might have formed elsewhere in the solar system. Planets like Jupiter and Saturn, which have numerous moons, are farther away from the Sun and therefore have a greater chance of capturing moons that have been formed elsewhere.
Lastly, it is also possible that Mercury and Venus may have had moons in the past but lost them due to various factors. Moons can be lost due to collision with other objects or gravitational interactions with planets or other moons over long periods of time.
Overall, the combination of their close proximity to the Sun, difficulty in capturing moons, and potential loss of moons in the past are some factors that contribute to Mercury and Venus not having any known moons in the solar system.