Can I know if there are any scripts through which I can find out what all resources I purchased (ore,wood,mercury,etc) from facilities.
And where I sold them off (again at facilities)
I don't think there's one.
As long as you buy them lower than the price you sell in facilities you have a profit.
Ore and wood are not profitable for this but they can help you to keep a mine open to work so you can sell something more profitable i.e. at foundry's mine so to sell mithril ore.
Doing the full circle and using all the resources ire till up to orichalcum, will give you the max profit from this "job" but it needs time and running a lot on the map.
Buying and selling prices where better some years ago, you can do less profit now than before but always a profit.
Some of them are using scripts to purchase Sulfur, I mean like even though I'm continuously refreshing the page, I still miss buying Sulfur the next second of SHIFT End.
You mean to purchase, I thought you mean how many and from wher you bought as a history log.
Some people may use auto buyers, it's forbidden and lose character if get caught, but there are tens of more people like you and me who are on the mine like crows when shift ends, pushing F5 like there's no tomorrow. :)