Way to get vertex index to use in new vertex group from selected faces I try and not undertand if i am on the right way, that code i want to set the select
faces, make a vertex group, this is a piece of code:

    ob = bpy.context.object
    me = ob.data
    bm = bmesh.from_edit_mesh(me)


    vertex = [v for v in bm.verts if (v.select==True and not v.hide)]       
    ver_grp = ob.vertex_groups.new(name = "My vertex group")

    ver_grp.add(???,0,'Replace')###not sure if replace can make ex novo
You are on the way

Let's talk about the vertex list line first

You can use v.index for list: vertex = [v.index for v in bm.verts if (v.select==True and not v.hide)], so the vertex will be a list contains your vertices indices.

Next, vertex_group.add() method:

It need 3 arguments (index, weight, type):


index: should be a list contain indices
weight: should be a float value in 0.0~1.0
type: should be a string in {'REPLACE', 'ADD', 'SUBTRACT'}


So you can use ver_grp.add(vertex,1.0,'REPLACE') for it

Sum up your code:

ob = bpy.context.object
me = ob.data
bpy.ops.object.mode_set(mode='EDIT') #You need to enter edit mode for bmesh
bm = bmesh.from_edit_mesh(me)

# not a good practice to use vertex for vertices indices list
v_indices = [v.index for v in bm.verts if (v.select==True and not v.hide)]      
ver_grp = ob.vertex_groups.new(name = "My vertex group")

bpy.ops.object.mode_set(mode='OBJECT') #You need to enter object mode for add()
# Add . in float number help people know it is a float instead of int
ver_grp.add(v_indices, 1.0, 'REPLACE') # most of the blender string enums use upper case