(#19552) Fix the handling of special cron schedules

The output logic for adding name and environment lines to crontab lines
was only implemented for one of the supported record types. To make the
behaviour more consistent, the provider was refactored. The code for
generating these additional lines was moved to independent methods.
The to_line methods of both record types now make use of those.