My guess when I see this error message is that the length of your string is not large enough to store the value of "name". Check in your "Add field" step to make this.
By the way, string manipulation is better done with Python:
import arcpy, glob arcpy.env.workspace = "your_workspace" #fcs = arcpy.ListFeatureClasses("*") #get the list of feature classes fcs = glob.glob("c:\\*\\*.shp") #EDIT tobemerged = [] for fc in fcs: print len(fc) #check for the length of your name arcpy.AddField_management(fc, "name", "TEXT", 150) #length of 50 is usually enough arcpy.CalculateField_management(fc, "name", fc, "PYTHON") #[:-4] because I assume that you have a shapefile and remove the extension tobemerged.append(fc) arcpy.Merge_management(tobemerged, "output_feature_class_name")