im new at knitting and just started learning the knit stitch doing several rows but whenever i do the stitch it ends up having both the knit and purl stitch alternating whenever i start a new row. why is that

The back of a knit st is a purl, so when you turn it at the end of the row, you see the purl stitch. After a few rows if you pull the knitting down from the needle you’ll see the V knit sts between the purl bumps.

so how do i change that?

You can’t ‘change’ the nature of the stitch itself. If you knit a row then purl a row, you get all the knits on one side and the purls on the other side - is that what you want? If you make a scarf like that, the edges will curl, so you would keep 4 or 5 edge sts in garter stitch, which is knit every row. So after knitting about 5 or 6 rows, on the next row you knit a few sts, then purl to the last few sts. Knit the next row, then do the knit a few, purl to last few and knit. Keep repeating until you’ve got enough yarn to knit the last few rows.

If you knit all rows, you will have a garter stitch. What some new knitters don’t know is that you can also do a garter stitch by purling all rows. Some knitters prefer to purl for garter stitch. Whatever’s easier for you.