Ummm... not to ask a dumb question, but isn't fitting a straight line to a linear equation redundant?
What are you using to display the data? You can use a graph or XY graph to do this. Just need to create your data into an array of clusters and feed it to the graph.
Note that if you want this in "real time" (whatever that may be), then the Excel writing will probably not be part of it, since that's file I/O. Are you running this on a real-time OS?