Help with script for assigning materials to objects

I'm having a lot of trouble getting a script to work to assigning materials from my materials library to a series of objects (polygons), in alphabetical order. The order is simple:
1. Obtain list of Materials from the scene
2. Target a specific group of objects (say, a Group that contains a series of polygon shapes)
3. Assign the 1st material from the Materials list to the 1st polygon shape in the Group;
4. Iterate in alphabetical order repeating the process, until either run out of materials or run out of shapes (the list of materials usually contains less units than the list of polygon shapes)

I've created the following script that apparently runs, but the results are none (no materials get assigned, although it tells me that they were). What could I be doing wrong?

The usual help is much appreciated! :)