You've got a number of issues.
You've confused dirpath and allfiles and used them incorrectly in your code. The result of Pick Directory(), dirpath, will be a string that is the path to the directory that the user chooses. You've tried to use it in the indexing of your For() loop below as if it had the list of files.
The result of Files in Directory(), allfiles, will be the list of files in the directory. That's what you should be looping over.
You'll need to Open() the data tables before you can add the new column.
Since the allfiles list is only the filenames, you'll need to concatenate the directory, dirpath, in the argument to Open().
Finally, you should make sure that you're only trying to open JMP data tables by checking the extension on the files. In the example code below, I do that with the Word() function. The -1 argument asks for the last word in the string.
dirpath = Pick Directory();
allfiles = Files In Directory( dirpath );
// Loop through each of the files and add the column
Show( allfiles );
For( i = 1, i <= N Items( allfiles ), i++,
If( Word( -1, allfiles[i], "." ) == "jmp",
dt = Open( dirpath || allfiles[i] );
dt << New Column( "Sequence", numeric, formula( Row() ) );
)
);
Check out the Get Started section of the Data Tables chapter of the Scripting Guide for an introduction to working with data tables.
-Jeff