Just make a disc with a spiral groove cut in it. Make it rotate slowly, either with a standard motor and gearbox or with a stepper motor. Make a spigot for the water to pass through and engage it in the spiral slot and also make it pass through a straight slot in a fixed bracket, aligned with the center of the disc. As it turns, the spigot will be pushed by the spiral slot making it traverse the straight slot. Then rotate the cup/mug to get the final pour pattern.
The XY plotter method will work but it will be mechanically awkward to make small enough for a coffee machine.
You could copy the method in the image which would be based on orbital gears but only needs one motor.
Brian.