its simple, as the big bob conlon said from unsw
since no firm has the ability to influence the market in perfect competition they cannot set the price
they are price takers - so they can supply as much or as little as they want at the market price - hence a horizontal demand curve where AR=D=P
have a nice day