During namaz a person recited takbiratul ihram and immediately bent down for ruku but then rose up after realizing the mistake without reciting anything. The person continued with surah hamd. This mistake of bending down, does it affect namaz?

Since an extra ruku has been added, the prayer is void and must be repeated. Ruku is a rukn of Namaz therefore any addition or subtraction of it in namaz makes the prayer void. Recitation of surahs is a ghayr rukn therefore if a person mistakenly omits it, the prayer is correct and one should just continue the prayer as usual. Therefore when realising the mistake in ruku, one should just continue with the prayer rather than getting up, reciting the surahs and going back to ruku (therefore adding a rukn).