Do you think this will work?

A "transistor" cannot be used to switch household AC.

You should purchase a safety approved module for that purpose, something like the PowerSwitchTail. No modifications to the coffeemaker necessary!