Hi Sweta,
Just guessing, but since lava looks to your qemu.jinja2 file in the /etc/lava-server/dispatcher-config/device-types/ directory as the template source, it no longer refers to the original template you seem to want to extend from. Hence the recursion, as it keeps attempting to extend from itself (your qemu.jinja2).
Try copying the contents of the original template file into your qemu.jinja2 template file you have created. The original template may be in the directory /usr/share/lava-server/device-types, as that's where mine is. A shortcut to do this would be running the command below: cp /usr/share/lava-server/device-types/qemu.jinja2 /etc/lava-server/dispatcher-config/device-types/qemu.jinja2
If you have any specific settings in your qemu.jinja2 in the /etc/.../device-types path, then save it somewhere else so you can put it back in afterwards. I hope this helps.
Best regards, Michael