The MQTT Input node must be hardcoded with the topic filter to use - it cannot be changed dynamically.
The MQTT Input node can now be configured to support dynamic subscriptions, so this Cookbook page is both out of date and misleading. When you enhanced the MQTT Input node, you didn't update the Cookbook documentation at the same time.