The shape water cantrip description says:
You choose an area of water that you can see within range and that fits within a 5-foot cube. You manipulate it in one of the following ways:
- You move the water up to 5 feet in any direction. This movement doesn’t cause damage.
- You cause the water to form into simple shapes and animate. This change lasts for 1 hour.
- You change the water’s color or opacity. This change lasts for 1 hour.
- You freeze the water, provided there are no creatures in it. The water unfreezes in 1 hour.
- If you cast this spell multiple times, you can have no more than two of its non-instantaneous effects active at a time, and you can dismiss such an effect as an action
Following those rules I can think of several ways you could use shape water in an offensive way (a few of them are pushing it, though):
- Take the water and move it onto the head of the creature within 5 feet of the point of origin, thereby drowning them.
- Move the water above the head of the enemy freeze it and drop it onto their head or don’t freeze it and have enough volume or height. (got that idea from transmute rock).
- Turn the water into a weapon made of ice and attack with it.
- Turn the water into a cube of ice, shatter it, then launch the shards at an enemy. (Basically a grenade only 100x more awesome).
- Depending on the DMs interpretation of how freezing and unfreezing the water works you could say that you simply raise or lower it’s temperature. So you could say heat the water to boiling temperatures then throw it at the enemy.
How else does one use shape water offensively, so that it deals damage?