Monitor FOR loop progress in postgres
By adding raise notice. It will keep printing value of i -- so that you will always have idea about loop progress.
    DO
    $do$
    BEGIN 
    FOR i IN 1..20000
    -- update some rows
    raise notice 'Current Progress Value i:%',i;
     LOOP
    END LOOP;
    END; 

Or more better way.

Create a sql file  : vi loop.sql  -- add your loop into this file with raise notice.

Run as a job: psql -U username -d database_name -a -f loop.sql &amp;&gt;progress_log

Keep monitoring latest id : tail progress_log


Note: One more tip- I think you need to initialize i - need to include a declare section. Like below:(sample)
    DO
    $do$
    DECLARE
    i int8;
    BEGIN
    -----your code--
    END;