You need to calculate the ratio of both the range of x values to plot compared to the width of the display area, and the ratio of the range of y values to plot compared to the height. Choose the smaller of the two ratios and use that for the multiplier for the plot values of BOTH sets of coordinates.
That will maximise the scale of the plotted course but without distorting.

--get the range of x values to plot
--I'm not sure where you get them, but it would be something like
put field "theXCoordinatesList" into tXlist
--if comma delimited, you can:
--put min(tXlist) into tXmin
--put max(tXlist) into tXmax
--otherwise, if cr delimited (one value per line):
put tXlist into tXsorted
sort tXsorted numeric ascending
put line 1 of tXsorted into tXmin
put the last line of tXsorted into tXmax
put tXmax - tXmin into tXrange
--do the same for the range of y values to plot
put field "theYCoordinatesList" into tYlist
--if comma delimited, you could:
--put min(tYlist) into tYmin
--put max(tYlist) into tYmax
--otherwise, if cr delimited (one value per line):
put tYlist into tYsorted
sort tYsorted numeric ascending
put line 1 of tYsorted into tYmin
put the last line of tYsorted into tYmax
put tYmax - tYmin into tYrange
--compare the range of x values to the width of the display area
--(be prepared for this to change on different mobile hardware or resizeable stack)
--for now it's hard coded as 320
put 320 into tDisplayWidth
put tDisplayWidth / tXrange into tXratio
--do the same to compare the range of y values to the height of the display area
--(be prepared for this to change on different mobile hardware or resizeable stack)
--for now it's hard coded as 480
put 480 into tDisplayHeight
put tDisplayHeight / tYrange into tYratio
--to keep the whole plot on the screen but keep the dimensions in the same proportion
--we choose the smallest ratio
put min(tXratio,tYratio) into tRatio
--plot the points (using the unsorted lists), in this case using a line to draw between points on a course
--if it was a comma delimited list then substitute "line" for "item" in the line below
repeat for each line tXcoord in tXlist
--take off the minimum value as we're using that as the origin for the plot
--so the minimum now becomes zero
put (tXcoord - tXmin) * tRatio + 1 into tNewX
put tNewX & cr after tNewXlist
end repeat
repeat for each line tYcoord in tYlist
--take off the minimum value as we're using that as the origin for the plot
--so the minimum now becomes zero
put (tYcoord - tYmin) * tRatio + 1 into tNewY
--but Y coordinates plot from the top of the card so turn it upside down
--so that the course has the lowest y value at the bottom of the card
put tDisplayHeight - tNewY into tNewY
put tNewY & cr after tNewYlist
end repeat
repeat with i = 1 to the number of lines of tNewXlist
--you have a problem if the number of lines of tNewYlist doesn't match!
put line i of tNewXlist & comma & line i of tNewYlist & cr after tPlotPoints
end repeat
set the points of graphic "grcCoursePlot" to tPlotPoints
set the visible of graphic "grcCoursePlot" to true

There's a sample stack attached with this code crudely implemented to demonstrate the principle