generate_filename function

Generate filename for write operations