Not sure if I understood your problem correctly, but if you run the select and when looping through the result you decide the file name.
So something like:
DECLARE
emp_rec employee%ROWTYPE;
CURSOR cur_emp IS SELECT e.*
FROM employee e
WHERE ...the conditions..;
emp_file UTL_FILE.FILE_TYPE;
BEGIN
OPEN cur_emp;
FETCH cur_emp INTO emp_rec;
WHILE cur_emp%FOUND LOOP
emp_file := UTL_FILE.FOpen('directory', TO_CHAR(emp_rec.emp_id) || '.txt','w');
UTL_FILE.Put_Line(emp_file, ...data to write..., 1);
UTL_FILE.FClose(emp_file);
END LOOP;
CLOSE cur_emp;
END;