Neither of your sentences is correct.
For - is a perposition which is followed by a noun. It show how long something lasts.
In your case the suitable preposition will be during, which tell us when smth is happened, and also it is used with a period of time.
So the correct sentence will be
During the last he had been staying here
Since tells us when smth started
Ago tells us how far in the past smth happened
One week ago, he stayed here. Past Simple because there is a specific time mentioned.
1-For the last week, he has been staying here.
2-For the last week, he had been staying here. Possible, but not without further context- where he's gone, etc.
3-Since one week ago, he has been staying here.
4-Since one week before, he had been staying here.
I don't like the 'since one week ago' much. I think it's more used by British speakers- I remember some Americans saying it was wrong and were surprised that it was used in a British ESL exam. 4 doesn't work at all.
Here's a third opinion. "last" doesn't seem to work for my North American dialect. But if I change "last" to past, it works:
1-For the past week, he has been staying here.
2-For the past week, he had been staying here.
The reason "past" seems to work and "last" doesn't is that "last week" expresses a definite time;i.e., not this week, but last week, whereas "past week" expresses a duration; i.e., over the past week. "for" expresses duration, so it needs a compatible durative object; e.g., for three days, for 2 weeks, etc.
It appears you're dealing with the morpho-semantic interface, last, past. In other words, both are similar in sound and meaning, and the reason, possibly, that (some) speakers use them interchangeably, and why others are starting to pick up on it and use it.
last week (non-durative)
=> a specific period of time; that is, its starting point and ending point are relative to today.
EX: For the last week, . . .
Prescribed rule: "for" (durative); for the *last week <ungrammatical>
Descriptive rule: "for" (durative); for the last week <grammatical>
=> last" sounds like past, a durative; "last" functions like past, an adjective, and "last" means something similar to past.
As for 3 and 4, below, I agree with tdol. 4 doesn't work, but it could work in some dialects. And the same holds true for 3, in some dialects.
Note, the perfect aspect is not compatible with defined time; e.g., since yesterday, since today, since last week, but add "ago" or "before" and we get a whole new meaning,
3-Since one week ago, he has been staying here. and
4-Since one week before, he had been staying here. and
The reason being, (and here's an old trick of the linguistics trade) consider what's not there,
3- Since one week ago [today], he has been studying here. <in some dialects>
"today" is compatible with the time expressed by the perfect aspect; i.e., from some unknown time in the past all the way up to now, today, the time of the speaking event.
Same holds true for 4.
4- Since one week before [today], he had been staying here. <in some dialects>
Note, with the past perfect, all one needs is a second event to complete the "perfection".
Cas, you are getting better and better at explaining these things. Are you a professional linguist? I just love the way you explain these things. To me it is very logical and very clear.
I'd disagree about perfect tense being incompatible with 'since yesterday',but maybe that it just a slip on your part, or maybe it is ignorance on mine or it is the result of a difference in dialects.
In any case, your explanation is brilliant.