As is often the case this turns out to be more of a mathematical problem than a programming problem. Although it has been at least ten years since I have done any real programming, I can give some mathematical help.

It is the case that all you must do is to list all the possible bit-strings of length n. Each such string represents one subset of a set of n elements. The attached pdf file will give you the rational for that.

I can give you the code that I use to generate a table of these strings using a very elementary CAS.

It is:

This produces all 8-bit strings. Change the value of N to produce all N-bit strings.