I am new to SEO and I want to know if what I am asking is doable, legal and morally legal:
I am want to put so code on my one website to improve the rank of other website so that every time the first is surfed it load the or fetch the other site.
That would would be morally indefensible, costly, would possibly get you banned by search engines and wouldn't actually help you at all ... I don't recommend it.
Morally indefensible - when people visit a website, they have a right to expect that that is the website they are going to. Sometimes there are valid reasons why you might scrape content from another site or download elements of another page in order to provide a better service, but that isn't what you're doing. And for people on mobile devices or other slow connections, that extra download is going to be very unwelcome.
Costly - if you're effectively doubling the number of hits on your servers, that's going to double your bandwidth usage, which may have a financial impact if you pay per MB or if it hits a threshold.
Would possibly get you banned - search engines are very keen to stamp out any dubious practices where people try to subvert their rankings. They would possibly see this as a form of cloaking, which is explicitly forbidden.
Probably won't help - search engines don't know how many hits you've had on any page or site. So just increasing the number of hits won't make any difference.