Hello nupur,
You can give file name depending on the input of two fields. First you should have two fields named dept and serial number field in your InfoPath form. To give file name follow these steps:
1. Go to Tools -> Data connections.
2. Click on “Add”, Select Submit data and click on Next.
3. Select “To SharePoint form library” and click on Next.
4. Enter the share point form library url, click on fx button.
5. Click on “Insert Function” button in Insert function window.
6. Select All in Categories, Concat in Functions and click OK.
7. Double click on “double click to insert field” and select the field you want to have in file name.
Hope this helps!