Apparatus and method for adjusting width of rail mechanism