I thought that oneday is used for representing past tense and someday for future. but I saw oneday is used for representing future in the context yestreday. Can "oneday" represent future as in "Oneday, I will be a doctor."?
"Oneday" is not a word. If you saw it used, the writer was making a mistake.
"One day" (two words) can be used in the past or the future. A common "past" usage is something like this: "He saw George every day, but one day when he went outside, George wasn't there."
"One day" is also often used in reference to the future, just as is "someday" (which is a single word). Their meanings are similar, but "one day" is usually more poetic, or more dramatic, or more connected to someone's serious intention, and has a much looser connection to time. "One day, this world will be a perfect place to live." "One day, you will have all the money you could ever want." "One day, no human being will go hungry!" Notice that these statements have the nature of "vows," or promises. And notice that these are things that could happen at almost any time in history.
"Someday" is less dramatic, and gives more of a sense that the event in question will be the result of nothing more than the forward movement of time. "Someday I will see Paris." "Someday my prince will come." One gets a sense that these are things that are pretty much expected to occur in the natural course of events, that they won't take any really unusual amount of effort, and that they are likely to occur within a reasonable period of time. Notice that these statements are more in the nature of simple factual statements (rather than "vows").
The first thing to say is that one day is written as two words, except when used as an adjective, when it can occur as one-day. Some day is also written as two words, except when, as in your example, it is an adverb (although even then you might still find it as two words).
The choice between the two has little to do with the timeframe. In saying One day, I will be a doctor, the speaker shows a degree of determination and certainty which is lacking in the vaguer Someday, I will be a doctor.