I'm not sure exactly what you want there, but the quoting is messed up in that last line. My guess is that you want:
$config_file .= '$roster_dir = "modules/'.$module_name.'";' . "\n\n";
PS: You might find it less error-prone to use sprintf(), which would allow you to separate the string syntax from the variables, e.g.:
$config_file .= sprintf(
'$roster_dir = "modules/%s";%s',
$module_name,
"\n\n"
);