Add node into multiple materials
Try this
import bpy

group_name = &quot;ColorGold&quot;

for mat in bpy.data.materials:
    if not mat.name.startswith(&quot;GLOBE_&quot;): continue

    # Find Principled node
    for n in mat.node_tree.nodes:
        if n.type == 'BSDF_PRINCIPLED': break
    else: continue

    # Find Base Color texture node
    soc = n.inputs[&quot;Base Color&quot;]
    if not soc.links: continue
    if soc.links[0].from_socket.name != &quot;Color&quot;: continue
    tex = soc.links[0].from_node
    if tex.type != 'TEX_IMAGE': continue

    # Insert group node
    g = mat.node_tree.nodes.new(&quot;ShaderNodeGroup&quot;)
    g.node_tree = bpy.data.node_groups[group_name]
    g.location = tex.location[0] + 100, tex.location[1]
    tex.location = tex.location[0] - 250, tex.location[1]
    mat.node_tree.links.new(g.outputs[0], n.inputs[&quot;Base Color&quot;])
    mat.node_tree.links.new(tex.outputs[&quot;Color&quot;], g.inputs[0])