Converting by division (that's what you are doing) produces "digit" in the new base in least-significant first order (from right to left, as normally written). That means you can's just print them as you go.
It looks like you're using Python 3.x, which I don't have installed, so use this as an idea, not a copy-paste:
To get the first digit:
output = str(m%2)
m = m/2
Getting the next digit, after one or more have been converted already, is almost the same:
output = str(m%2) + output
m = m/2
Notice that the digit is tacked onto the LEFT side of the previous value of output. That puts the digits in order so when you are done converting you can just:
print(output)
The type of loop depends on how you want to format the number. To get a fixed number of bits, padding leading 0 bits if needed, you can use a for loop. If you want to suppress leading zeroes, convert the first bit outside the loop, in case the original number was 0, and then:
while m != 0:
... convert the next digit
You can use a while to combine both features:
while m != 0 or len(s) < MIN_LENGTH:
... convert the next digit
That will convert at least (MIN_LENGTH) bits, padding 0s if needed, but keep on going if the binary representation of the original m value is more than (MIN_LENGTH) bits.
Warning: The while versions above will loop forever if given a negative value for m. You should test for and eliminate that possiblity. The fixed-width for-loop version will print out the twos-complement representation, truncated to the number of bits converted by the loop.