The button hole attachment works by blocking the feed dogs, and moving the fabric itself. It follows the profile of a cam that defines the shape and size of the button hole. It can't be used as a general purpose zig-zager. You could, with some annoyance, use one to make bar tacks, by sewing only one side of the buttonhole. The cams are interchangable, you need to make sure you get ones to do the buttonholes you need to make. (Early, early models don't have interchangable cams, but have screws to set the size, width, and density of the stitching.)
There were standalone zig zag attachments made. They work much the same way, minus the cam part. I've never used one, though. They're much rarer, and more expensive.