As stated in the template you only have to change this line
bpy.ops.export_scene.fbx(filepath=fn + ".fbx", use_selection=True)
with this line
bpy.ops.export_mesh.ply(filepath=fn + ".ply", use_selection=True, axis_forward="Y", global_scale=1, use_colors=True)
The keywords arguments can be inferred by hovering over the operator properties when you execute the operator using the UI.
First enable the python tooltips
Go to File > Export > ply
Hover over the field you want to tweak and note the attribute name. Here it's
If you want to know the expected value, change it using the interface and open an Info editor. The value will be written there. Don't mind the left part of the equal sign, it's garbage.
The operator python command can be found by hovering over the menu entry in File > Export.