You cannot obtain the Black Flute in Pokémon HeartGold. It is exclusive to Pokémon SoulSilver.
In SoulSilver, the Black Flute summons Ho-Oh at the Bell Tower (Ecruteak City) after obtaining the Rainbow Wing. In HeartGold, Ho-Oh is encountered via the Rainbow Wing alone—no flute required. The flute is essentially a version-exclusive key item for the counterpart legendary encounter.