When you drop the yarn at the buttonhole and attach a new yarn, you're going to leave a space between the old yarn and the new yarn. The two stitches will not be connected. This is the start of your button hole.
You work to the end of the row with the yarn that you've connected. When you turn to purl back, you work up to the hole, drop your yarn, pick up the yarn on the other side of the hole and work to the end.
Turn, knit back up to the hole, drop the yarn, pick up the other yarn, etc.
For however many rows you do this, you will not be connecting the row. there will be a gap as if you had two separate pieces of knitting on your needle.
When the hole is the length you want it to be, you knit straight across the top and this will once again join the two pieces together. You will have to reinforce the top and bottom with a little stitch, or the stitches there will be stretched out.