No, the hex is not an attack action but a bonus action. You can use it to place a curse on a creature that is within your range. In case that the creature that is hexed by you drops dead or goes to 0 hit point, you can use your bonus action to cast the hex on another creature.