It should be executed only once. Probably it should be exexuted also after cPanel upgrade (if cPanel will override this changes). Accounts and FrontPage Extensions added later will have automatically correct permissions to file service.pwd.
I am no expert of sed scripts, does your script change the permssion of service.pwd to 0644? It might be a security hole if it does.
0640 should be good to me if it is owned by "nobody" group.
The owner of service.pwd is $user:$user. It change perms to 0644, but permissions to public_html directory at cPanel servers are 0750 (owner $user:nobody).