Otherwise it would not be certain how much stock they can sell for what price, so they run a risk of having the offering fail (i.e., not sell all the offered shares).
To clarify: usually the underwriters take the risk of selling the shares. If they don't sell all of offered shares to the public, they have to buy the remaining shares themselves.
To clarify: usually the underwriters take the risk of selling the shares. If they don't sell all of offered shares to the public, they have to buy the remaining shares themselves.