Adding a new material to a grease pencil
The script below enables you to add a new material slot for your active grease pencil.

import bpy

ob = bpy.context.active_object  # Must be a GPencil object
mat = bpy.data.materials.new(name="Mymaterial")
bpy.data.materials.create_gpencil_data(mat)
ob.data.materials.append(mat)