Code:
LeftScrollBar.scrollChild.button = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild)
the above code always sets the reference to your button to LeftScrollBar.scrollChild.button as such the reference is overwritten each time through the loop.
You should do something like this
Code:
LeftScrollBar.scrollChild.button[bnid] = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild)
that way you always have a reference to it via LeftScrollBar.scrollChild.button[i] (where i equals 1 through n)