The sentence is intelligible, but not quite correct yet! First, you don't need the definite article "the", here. So it should be "Layer A" and "Layer B". And I don't know much about computers, but maybe you should use "retrieve" or "access" instead of "obtain"?
Finally, "to directly obtain" splits the infinitive. An infinitive is the original form of an English verb, like "to be“ or "to eat". Splitting the infinitive means inserting a word between "to" and the verb itself, as in "to directly obtain". You should put "directly" after "to obtain".
It's hard to say more without context, but the final sentence should be something like: "Layer A stores data for Layer B to obtain [access?] directly." Or maybe this: "Layer A stores data that Layer B can access directly."