The unquoted EOF heredoc expands all $ at install time. Runtime
variables inside functions (CPU, RAM, AGENT_KEY, etc.) must be
escaped with $ to prevent premature expansion.
Also removed the fragile sed replace step entirely — values are now
embedded directly when the heredoc is expanded.