In reply to Abhishek S:
UVM is designed so that you can use a scoreboard/comparitor to do transactional checking while your test is in progress. This allows better debug as you can easier pinpoint when your errors occur.
If you want to do file compare, you probably want to do it in the check_phase() when all data is written to your files instead of the run_phase() while the files are being written.