It is good to have students draw pictures of the effects. Magnetic materials such as iron have microscopic regions called magnetic domains. Each domain acts like a tiny bar magnet with a north and south pole. This is shown when the filings are aligned by passing them over a bar magnet. The students can actually see the change in the arrangement of the filings.
Scientists say that the material has now been magnetized - or turned into a magnet.
By shaking the tube the filings are randomly jumbled up again with no preferred orientation so that the test tube no longer acts like a magnet when brought near a compass.