Saving temporary scratch layers using PyQGIS and visualizing them in your QGIS Project

Since, I have been saving the generated files in scratch layers whenever they are intermediate products, of auxiliary nature to the process I am running. This way, they are automatically deleted, and I don’t have to worry about them after executing my code. So, I decided to summarize how I save PyQGIS tool outputs in scratch layers, in case this is useful to someone out there!