The black lines you're seeing are the borders of the cells which aren't hidden.
Makes sure the cells which remain visible don't have borders adjoining the hidden cells.
Format only the cells which will be hidden and their borders will be hidden when the cells are hidden.
See attached and:
Why Cell Borders Disappear When Hiding Rows & Columns + Video - Excel Campus
ps. It's a good idea to say thanks a bit more - makes it more likely people will help you again…