It is quite easy to write files from Perl, see open and print. Be sure to chmod (assuming UNIX). When calling the script using system or qx it is probably best to pass the full path name.
On the other hand, would it not be better to write it in Perl? Off hand I can't think of anything shell scripts can do (even the very latest versions) that Perl cannot.