How to measure electricity used by hot water heater
If you can afford the metering equipment then purchase and install that. Gives you the direct total energy use...

If not then you have to consider a different direction...

So, go the easy route: measure the hot water use over a week: measure shower times and take a suitable average then with the flow rate calculate how much hot water was necessary (gallons or litres... up to you - convert or use which you like). Measure all activities that use hot water and multiply by how many times per week.

Now you have the total hot water used and so you can use Q = MCp (T2 - T1) and get the total energy which leads you to the cost if you know how much you pay per unit.  You can take Cp to be 4.18 kJ/kg K for the accuracy you will be working with.

Also include an efficiency figure - the tank is not perfectly insulated etc...

The average hot water use is around 40 to 60 L/person/day  at 60 deg C - a European rule of thumb - may well be different  for other locations some places have larger bath tubs than others... Or take longer showers...