A 36-year-old man accused of breaking into a house to carry out a “vigilante” attack on a male occupant targeted the wrong property, a court has been told.